Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB8-181: Maintain a whitelist of semi-sync slaves which can ACK transactions #1017

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mysql-test/include/rpl_connection_slave2.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let $rpl_connection_name= slave2;
source include/rpl_connection.inc;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VARIABLE_NAME LIKE '%slave%') AND
'reset_seconds_behind_master', 'skip_flush_master_info'))
ORDER BY VARIABLE_NAME;

include/assert.inc ['Expect 87 variables in the table.']
include/assert.inc ['Expect 88 variables in the table.']

# Test SET PERSIST_ONLY
SET PERSIST_ONLY binlog_cache_size = @@GLOBAL.binlog_cache_size;
Expand Down Expand Up @@ -96,6 +96,7 @@ SET PERSIST_ONLY rpl_semi_sync_master_trace_level = @@GLOBAL.rpl_semi_sync_maste
SET PERSIST_ONLY rpl_semi_sync_master_wait_for_slave_count = @@GLOBAL.rpl_semi_sync_master_wait_for_slave_count;
SET PERSIST_ONLY rpl_semi_sync_master_wait_no_slave = @@GLOBAL.rpl_semi_sync_master_wait_no_slave;
SET PERSIST_ONLY rpl_semi_sync_master_wait_point = @@GLOBAL.rpl_semi_sync_master_wait_point;
SET PERSIST_ONLY rpl_semi_sync_master_whitelist = @@GLOBAL.rpl_semi_sync_master_whitelist;
SET PERSIST_ONLY rpl_semi_sync_slave_enabled = @@GLOBAL.rpl_semi_sync_slave_enabled;
SET PERSIST_ONLY rpl_semi_sync_slave_trace_level = @@GLOBAL.rpl_semi_sync_slave_trace_level;
SET PERSIST_ONLY rpl_send_buffer_size = @@GLOBAL.rpl_send_buffer_size;
Expand Down Expand Up @@ -129,16 +130,16 @@ SET PERSIST_ONLY sync_master_info = @@GLOBAL.sync_master_info;
SET PERSIST_ONLY sync_relay_log = @@GLOBAL.sync_relay_log;
SET PERSIST_ONLY sync_relay_log_info = @@GLOBAL.sync_relay_log_info;

include/assert.inc ['Expect 77 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 78 persisted variables in persisted_variables table.']

############################################################
# 2. Restart server, it must preserve the persisted variable
# settings. Verify persisted configuration.
# restart

include/assert.inc ['Expect 77 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 77 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 77 persisted variables with matching peristed and global values.']
include/assert.inc ['Expect 78 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 78 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 78 persisted variables with matching peristed and global values.']

############################################################
# 3. Test RESET PERSIST. Verify persisted variable settings
Expand Down Expand Up @@ -208,6 +209,7 @@ RESET PERSIST rpl_semi_sync_master_trace_level;
RESET PERSIST rpl_semi_sync_master_wait_for_slave_count;
RESET PERSIST rpl_semi_sync_master_wait_no_slave;
RESET PERSIST rpl_semi_sync_master_wait_point;
RESET PERSIST rpl_semi_sync_master_whitelist;
RESET PERSIST rpl_semi_sync_slave_enabled;
RESET PERSIST rpl_semi_sync_slave_trace_level;
RESET PERSIST rpl_send_buffer_size;
Expand Down
12 changes: 7 additions & 5 deletions mysql-test/suite/binlog_nogtid/r/binlog_persist_variables.result
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VARIABLE_NAME LIKE '%slave%') AND
'reset_seconds_behind_master', 'skip_flush_master_info'))
ORDER BY VARIABLE_NAME;

include/assert.inc ['Expect 87 variables in the table.']
include/assert.inc ['Expect 88 variables in the table.']

# Test SET PERSIST
SET PERSIST binlog_cache_size = @@GLOBAL.binlog_cache_size;
Expand Down Expand Up @@ -100,6 +100,7 @@ SET PERSIST rpl_semi_sync_master_trace_level = @@GLOBAL.rpl_semi_sync_master_tra
SET PERSIST rpl_semi_sync_master_wait_for_slave_count = @@GLOBAL.rpl_semi_sync_master_wait_for_slave_count;
SET PERSIST rpl_semi_sync_master_wait_no_slave = @@GLOBAL.rpl_semi_sync_master_wait_no_slave;
SET PERSIST rpl_semi_sync_master_wait_point = @@GLOBAL.rpl_semi_sync_master_wait_point;
SET PERSIST rpl_semi_sync_master_whitelist = @@GLOBAL.rpl_semi_sync_master_whitelist;
SET PERSIST rpl_semi_sync_slave_enabled = @@GLOBAL.rpl_semi_sync_slave_enabled;
SET PERSIST rpl_semi_sync_slave_trace_level = @@GLOBAL.rpl_semi_sync_slave_trace_level;
SET PERSIST rpl_send_buffer_size = @@GLOBAL.rpl_send_buffer_size;
Expand Down Expand Up @@ -134,16 +135,16 @@ SET PERSIST sync_master_info = @@GLOBAL.sync_master_info;
SET PERSIST sync_relay_log = @@GLOBAL.sync_relay_log;
SET PERSIST sync_relay_log_info = @@GLOBAL.sync_relay_log_info;

include/assert.inc ['Expect 72 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 73 persisted variables in persisted_variables table.']

############################################################
# 2. Restart server, it must preserve the persisted variable
# settings. Verify persisted configuration.
# restart

include/assert.inc ['Expect 72 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 72 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 72 persisted variables with matching peristed and global values.']
include/assert.inc ['Expect 73 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 73 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 73 persisted variables with matching peristed and global values.']

############################################################
# 3. Test RESET PERSIST IF EXISTS. Verify persisted variable
Expand Down Expand Up @@ -230,6 +231,7 @@ RESET PERSIST IF EXISTS rpl_semi_sync_master_trace_level;
RESET PERSIST IF EXISTS rpl_semi_sync_master_wait_for_slave_count;
RESET PERSIST IF EXISTS rpl_semi_sync_master_wait_no_slave;
RESET PERSIST IF EXISTS rpl_semi_sync_master_wait_point;
RESET PERSIST IF EXISTS rpl_semi_sync_master_whitelist;
RESET PERSIST IF EXISTS rpl_semi_sync_slave_enabled;
RESET PERSIST IF EXISTS rpl_semi_sync_slave_trace_level;
RESET PERSIST IF EXISTS rpl_send_buffer_size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ INSERT INTO rplvars (varname, varvalue)

# If this count differs, it means a variable has been added or removed.
# In that case, this testcase needs to be updated accordingly.
--let $var_count=87
--let $var_count=88
--echo
--let $assert_text= 'Expect $var_count variables in the table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM rplvars, count, 1] = $var_count
Expand Down Expand Up @@ -91,7 +91,7 @@ while ( $varid <= $countvars )
--inc $varid
}

--let $var_count=77
--let $var_count=78
--echo
--let $assert_text= 'Expect $var_count persisted variables in persisted_variables table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = $var_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ INSERT INTO rplvars (varname, varvalue)

# If this count differs, it means a variable has been added or removed.
# In that case, this testcase needs to be updated accordingly.
--let $var_count=87
--let $var_count=88
--echo
--let $assert_text= 'Expect $var_count variables in the table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM rplvars, count, 1] = $var_count
Expand All @@ -83,7 +83,7 @@ while ( $varid <= $countvars )
--inc $varid
}

--let $var_count=72
--let $var_count=73
--echo
--let $assert_text= 'Expect $var_count persisted variables in persisted_variables table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = $var_count
Expand Down
120 changes: 120 additions & 0 deletions mysql-test/suite/rpl/r/rpl_semi_sync_master_whitelist.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
include/rpl_init.inc [topology=1->2,1->3]
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
include/rpl_default_connections.inc
include/rpl_connect.inc [creating slave2]
call mtr.add_suppression("A message intended for a client cannot be sent there as no client-session is attached");
call mtr.add_suppression("Semi-sync master: Received an ACK from an unrecognized slave with UUID");
call mtr.add_suppression("Semi-sync master failed on net_flush.. before waiting for slave reply");
call mtr.add_suppression("Run function 'transmit_start' in plugin 'rpl_semi_sync_master' failed");
call mtr.add_suppression("Failed to register slave to semi-sync ACK receiver thread.*");
call mtr.add_suppression("Slave I/O for channel '': Master command COM_REGISTER_SLAVE failed: failed registering on master");
call mtr.add_suppression("Slave I/O for channel '': SET @master_heartbeat_period");
call mtr.add_suppression("Read semi-sync reply magic number error");
[connection master]
create table t1(a int) engine=innodb;
insert into t1 values(0);
include/sync_slave_sql_with_master.inc
[connection master]
include/sync_slave_sql_with_master.inc
[connection slave1]
include/assert.inc [The t1 table should have 1 row]
[connection slave2]
include/assert.inc [The t1 table should have 1 row]
[connection slave1]
[connection slave2]
[connection master]
set @@persist.rpl_semi_sync_master_whitelist = "slave1_uuid,slave2_uuid";
[connection master]
insert into t1 values(1);
insert into t1 values(2);
include/assert.inc [The t1 table should have 3 rows]
include/sync_slave_sql_with_master.inc
[connection master]
include/sync_slave_sql_with_master.inc
[connection slave1]
include/assert.inc [The t1 table should have 3 rows]
[connection slave2]
include/assert.inc [The t1 table should have 3 rows]
[connection slave1]
include/stop_slave.inc
[connection master]
insert into t1 values(3);
insert into t1 values(4);
include/assert.inc [The t1 table should have 5 rows]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 5 rows]
[connection slave1]
include/start_slave.inc
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 5 rows]
include/rpl_stop_slaves.inc
[connection master]
include/rpl_restart_server.inc [server_number=1]
include/rpl_start_slaves.inc
[connection master]
select @@global.rpl_semi_sync_master_whitelist;
@@global.rpl_semi_sync_master_whitelist
slave1_uuid,slave2_uuid
[connection slave1]
include/stop_slave.inc
[connection slave2]
include/stop_slave.inc
[connection master1]
insert into t1 values(5);
[connection master]
include/assert.inc [The t1 table should have 5 rows]
[connection slave1]
include/start_slave.inc
[connection slave2]
include/start_slave.inc
[connection master1]
include/assert.inc [The t1 table should have 6 rows]
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 6 rows]
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 6 rows]
[connection master]
set @@global.rpl_semi_sync_master_whitelist='-slave2_uuid';
[connection slave1]
include/stop_slave.inc
[connection master1]
insert into t1 values(6);
[connection master]
[connection slave1]
include/start_slave.inc
[connection master1]
set @@global.rpl_semi_sync_master_whitelist='+slave2_uuid';
include/assert.inc [The t1 table should have 7 rows]
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 7 rows]
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 7 rows]
[connection master]
set @@global.rpl_semi_sync_master_whitelist='';
[connection master1]
insert into t1 values(7);
[connection master]
set @@global.rpl_semi_sync_master_whitelist = "slave1_uuid,slave2_uuid";
[connection master1]
include/assert.inc [The t1 table should have 8 rows]
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 8 rows]
[connection master]
include/sync_slave_sql_with_master.inc
include/assert.inc [The t1 table should have 8 rows]
[connection master]
drop table t1;
set @@global.rpl_semi_sync_master_whitelist = ANY;
reset persist rpl_semi_sync_master_whitelist;
include/rpl_end.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$SEMISYNC_MASTER_PLUGIN_OPT --plugin-load=rpl_semi_sync_master=$SEMISYNC_MASTER_PLUGIN;rpl_semi_sync_slave=$SEMISYNC_SLAVE_PLUGIN
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$SEMISYNC_SLAVE_PLUGIN_OPT $SEMISYNC_SLAVE_PLUGIN_LOAD
15 changes: 15 additions & 0 deletions mysql-test/suite/rpl/t/rpl_semi_sync_master_whitelist.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!include ../my.cnf

[mysqld.1]
rpl_semi_sync_master_enabled=1
rpl_semi_sync_master_timeout=86400000 # 1 day

[mysqld.2]
rpl_semi_sync_slave_enabled=1

[mysqld.3]
master-retry-count=10
rpl_semi_sync_slave_enabled=1

[ENV]
SERVER_MYPORT_3= @mysqld.3.port
Loading