Skip to content

Commit 52c4533

Browse files
committed
MDEV-34071: Failure during the galera_3nodes_sr.GCF-336 test
This commit fixes sporadic failures in galera_3nodes_sr.GCF-336 test. The following changes have been made here: 1) A small addition to the test itself which should make it more deterministic by waiting for non-primary state before COMMIT; 2) More careful handling of the wsrep_ready variable in the server code (it should always be protected with mutex). No additional tests are required.
1 parent 4045a87 commit 52c4533

File tree

6 files changed

+11
-4
lines changed

6 files changed

+11
-4
lines changed

mysql-test/suite/galera_3nodes_sr/r/GCF-336.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SET SESSION wsrep_sync_wait=0;
2525
connection node_2;
2626
INSERT INTO t1 VALUES (2);
2727
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
28+
connection node_2a;
29+
connection node_2;
2830
COMMIT;
2931
ERROR 08S01: WSREP has not yet prepared node for application use
3032
connection node_2a;

mysql-test/suite/galera_3nodes_sr/t/GCF-336.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ SET SESSION wsrep_sync_wait=0;
2727
--connection node_2
2828
--error ER_LOCK_DEADLOCK
2929
INSERT INTO t1 VALUES (2);
30+
31+
--connection node_2a
32+
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
33+
--source include/wait_condition.inc
34+
35+
--connection node_2
3036
--error ER_UNKNOWN_COM_ERROR
3137
COMMIT;
3238

sql/slave.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3895,7 +3895,7 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi,
38953895
if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL &&
38963896
((rli->mi->using_parallel() &&
38973897
rli->mi->parallel_mode <= SLAVE_PARALLEL_CONSERVATIVE) ||
3898-
wsrep_ready == 0)) {
3898+
!wsrep_ready_get())) {
38993899
rli->abort_slave= 1;
39003900
rli->report(ERROR_LEVEL, ER_UNKNOWN_COM_ERROR, rgi->gtid_info(),
39013901
"Node has dropped from cluster");

sql/wsrep_mysqld.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3456,7 +3456,7 @@ void wsrep_ready_set(bool ready_value)
34563456
mysql_mutex_lock(&LOCK_wsrep_ready);
34573457
wsrep_ready= ready_value;
34583458
// Signal if we have reached ready state
3459-
if (wsrep_ready)
3459+
if (ready_value)
34603460
mysql_cond_signal(&COND_wsrep_ready);
34613461
mysql_mutex_unlock(&LOCK_wsrep_ready);
34623462
}

sql/wsrep_notify.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void wsrep_notify_status(enum wsrep::server_state::state status,
2424
if (!view)
2525
{
2626
WSREP_DEBUG("wsrep_notify_status server not yet ready : wsrep_ready=%d status %d",
27-
wsrep_ready, (int)status);
27+
(int) wsrep_ready_get(), (int)status);
2828
return;
2929
}
3030

sql/wsrep_server_service.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ void Wsrep_server_service::log_state_change(
340340
switch (current_state)
341341
{
342342
case Wsrep_server_state::s_synced:
343-
wsrep_ready= TRUE;
344343
WSREP_INFO("Synchronized with group, ready for connections");
345344
wsrep_ready_set(true);
346345
/* fall through */

0 commit comments

Comments
 (0)