diff --git a/mysql-test/suite/galera/r/galera_sequences_recovery.result b/mysql-test/suite/galera/r/galera_sequences_recovery.result index 11b02400960af..7c9f92488d4c8 100644 --- a/mysql-test/suite/galera/r/galera_sequences_recovery.result +++ b/mysql-test/suite/galera/r/galera_sequences_recovery.result @@ -31,6 +31,8 @@ SELECT LASTVAL(s); LASTVAL(s) 12 SET GLOBAL innodb_log_checkpoint_now=1; +connection node_1_ctrl; +# Wait for the next_not_cached_value = 21 FROM s (1_ctrl) connection node_1; INSERT INTO t1(f2) values (1); INSERT INTO t1(f2) values (1); diff --git a/mysql-test/suite/galera/t/galera_sequences_recovery.test b/mysql-test/suite/galera/t/galera_sequences_recovery.test index ff0f6b89bc952..f0f58a6924bfa 100644 --- a/mysql-test/suite/galera/t/galera_sequences_recovery.test +++ b/mysql-test/suite/galera/t/galera_sequences_recovery.test @@ -57,6 +57,16 @@ SELECT NEXTVAL(s); SELECT LASTVAL(s); SET GLOBAL innodb_log_checkpoint_now=1; +# Node 1 has an open transaction and wsrep_sync_wait is not effective +# inside a transaction. Wait here until node 1 has applied the sequence +# update replicated by NEXTVAL above, otherwise node 1 may still consume +# its own cached value before the update arrives. +--connection node_1_ctrl +--echo # Wait for the next_not_cached_value = 21 FROM s (1_ctrl) +--let $wait_condition = SELECT next_not_cached_value = 21 FROM s +--let $wait_condition_on_error_output = SELECT next_not_cached_value FROM s +--source include/wait_condition_with_debug.inc + --connection node_1 # Update the sequence value further INSERT INTO t1(f2) values (1);