Skip to content

Commit 509d103

Browse files
temeojanlindstrom
authored andcommitted
MDEV-20561 Galera node shutdown fails in non-Primary (#1386)
Command COM_SHUTDOWN was rejected in non-Primary because server_command_flags[COM_SHUTDOWN] had value CF_NO_COM_MULTI instead of CF_SKIP_WSREP_CHECK. As a fix removed assignment server_command_flags[CF_NO_COM_MULTI]= CF_NO_COM_MULTI which overwrote server_command_flags[COM_SHUTDOWN].
1 parent c946b5f commit 509d103

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
connection node_1;
2+
connection node_2;
3+
connection node_1;
4+
SET GLOBAL wsrep_provider_options = 'pc.weight=2';
5+
connection node_2;
6+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
7+
SET SESSION wsrep_sync_wait = 0;
8+
connection node_1;
9+
SET GLOBAL wsrep_provider_options = 'pc.weight = 1';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Check that server can be shut down in non-primary configuration.
3+
#
4+
5+
--source include/galera_cluster.inc
6+
--source include/have_innodb.inc
7+
8+
--let $node_1 = node_1
9+
--let $node_2 = node_2
10+
--source include/auto_increment_offset_save.inc
11+
12+
--connection node_1
13+
# Set higher weight for node_1 to keep it in primary
14+
# while node_2 is isolated.
15+
SET GLOBAL wsrep_provider_options = 'pc.weight=2';
16+
17+
--connection node_2
18+
# Isolate node_2 from the group and wait until wsrep_ready becomes OFF.
19+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
20+
SET SESSION wsrep_sync_wait = 0;
21+
--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'
22+
--source include/wait_condition.inc
23+
24+
# Verify that graceful shutdown succeeds.
25+
--source include/shutdown_mysqld.inc
26+
--source include/start_mysqld.inc
27+
28+
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
29+
--source include/wait_condition.inc
30+
31+
--connection node_1
32+
--source include/wait_condition.inc
33+
34+
# Restore original settings.
35+
SET GLOBAL wsrep_provider_options = 'pc.weight = 1';
36+
--source include/auto_increment_offset_restore.inc

sql/sql_parse.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,6 @@ void init_update_queries(void)
523523
server_command_flags[COM_STMT_SEND_LONG_DATA]= CF_SKIP_WSREP_CHECK;
524524
server_command_flags[COM_REGISTER_SLAVE]= CF_SKIP_WSREP_CHECK;
525525
server_command_flags[COM_MULTI]= CF_SKIP_WSREP_CHECK | CF_NO_COM_MULTI;
526-
server_command_flags[CF_NO_COM_MULTI]= CF_NO_COM_MULTI;
527526

528527
/* Initialize the sql command flags array. */
529528
memset(sql_command_flags, 0, sizeof(sql_command_flags));

0 commit comments

Comments
 (0)