diff options
| author | Michael Still <mikal@stillhq.com> | 2026-06-02 19:28:34 +1000 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2026-07-25 05:11:22 +0000 |
| commit | 1ebd7921f070a6266f71a50ac2d0fc58c818e34d (patch) | |
| tree | 0fe23ea21978da0da8f13559ccaf6e1cd3835182 /ansible | |
| parent | a32451738c1ae4e56fb5c4f88ad6c56b661b4530 (diff) | |
| download | kolla-ansible-1ebd7921f070a6266f71a50ac2d0fc58c818e34d.tar.gz kolla-ansible-1ebd7921f070a6266f71a50ac2d0fc58c818e34d.zip | |
Make the MariaDB WSREP sync wait defensive.
The "Wait for first MariaDB service to sync WSREP" handler runs
immediately after MariaDB opens its service port, and queries
wsrep_local_state_comment via the kolla_toolbox mysql_query
module. The first attempt frequently races MariaDB's privilege
bootstrap, so mysql_query can return a failure-shaped dict that
has no query_result key. The existing until expression then dies
with a Jinja AttributeError on result.query_result[0][0]['Value'],
and Ansible treats a template error in until as a hard failure
instead of "still false, retry". The configured retries: 10 /
delay: 6 budget is therefore never spent.
Guard the until expression so it only inspects query_result when
it is defined. mysql_query failures then leave the conditional
cleanly false, and the existing retries: 10 / delay: 6 budget
actually gets used. The first successful query lands within one
or two retries on every matrix we have seen.
Prompt: Michael asked for a patch that makes the MariaDB WSREP
sync wait defensive so that the existing retry budget actually
applies when the first mysql_query call comes back without a
query_result key.
Assisted-By: Claude Opus 4.7 (1M context, medium effort) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context, medium effort) <noreply@anthropic.com>
Change-Id: I4e5d7c2a8f9b1d3e6a4c5b8d2f1e0a3c4b5d6e7f
Signed-off-by: Michael Still <mikal@stillhq.com>
(cherry picked from commit c7792108f78eba3aae3f6278e3e21220b78aa5f9)
Diffstat (limited to 'ansible')
| -rw-r--r-- | ansible/roles/mariadb/handlers/main.yml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ansible/roles/mariadb/handlers/main.yml b/ansible/roles/mariadb/handlers/main.yml index 457abb48f..e684b48cc 100644 --- a/ansible/roles/mariadb/handlers/main.yml +++ b/ansible/roles/mariadb/handlers/main.yml @@ -46,7 +46,7 @@ login_password: "{{ database_password }}" query: 'SHOW STATUS LIKE "wsrep_local_state_comment"' register: result - until: result.query_result[0][0]['Value'] == "Synced" + until: result.query_result is defined and result.query_result[0][0]['Value'] == "Synced" retries: 10 delay: 6 listen: Bootstrap MariaDB cluster |
