From 1ebd7921f070a6266f71a50ac2d0fc58c818e34d Mon Sep 17 00:00:00 2001 From: Michael Still Date: Tue, 2 Jun 2026 19:28:34 +1000 Subject: 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) Co-Authored-By: Claude Opus 4.7 (1M context, medium effort) Change-Id: I4e5d7c2a8f9b1d3e6a4c5b8d2f1e0a3c4b5d6e7f Signed-off-by: Michael Still (cherry picked from commit c7792108f78eba3aae3f6278e3e21220b78aa5f9) --- ansible/roles/mariadb/handlers/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ansible') 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 -- cgit v1.2.3