forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FB8-181: Maintain a whitelist of semi-sync slaves which can ACK trans…
…actions (percona#1017) Summary: Jira issue: https://jira.percona.com/browse/FB8-181 Reference Patch: facebook/mysql-5.6@ee761fc Reference Patch: facebook/mysql-5.6@68f34521e82 Reference Patch: facebook/mysql-5.6@dfb038d48d0 Reference Patch: facebook/mysql-5.6@de1e8c7bfe7 Reference Patch: facebook/mysql-5.6@26835a39459 A whitelist of semi-sync slaves can be maintained using a new sys-var `rpl_semi_sync_master_whitelist`. The value of this variable is a comma separated list of UUIDs. ACK from any slave which is not in the whitelist will be ignored. The whitelist is persisted in file `semi_sync_master_whitelist.info` to survive server restarts. Porting notice: You have to use `set @persist.rpl_semi_sync_master_whitelist` to keep value across server restarts. Originally Reviewed By: Tema Pull Request resolved: facebook/mysql-5.6#1017 Reviewed By: yizhang82 Differential Revision: D15285223 Pulled By: yizhang82 fbshipit-source-id: 87fc3ba56d5
- Loading branch information
1 parent
1781b79
commit 57e1e06
Showing
25 changed files
with
804 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let $rpl_connection_name= slave2; | ||
source include/rpl_connection.inc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
mysql-test/suite/rpl/r/rpl_semi_sync_master_whitelist.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
mysql-test/suite/rpl/t/rpl_semi_sync_master_whitelist-master.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
mysql-test/suite/rpl/t/rpl_semi_sync_master_whitelist-slave.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$SEMISYNC_SLAVE_PLUGIN_OPT $SEMISYNC_SLAVE_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.