-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] Issue #37: Support MTS distributing in table level
MySQL 5.6 introduce Multi-Threaded Slaves(MTS) which significantly improved replicating capability of slave. However, the original MTS only support distributing in schema level, which limits the parallelism of worker threads. For example, if all updates on master is under one schema, there will be only one worker applying events, and degenerate to signle thread replication. To solve this problem, we add a new distributing level, table mode. In the new mode, events can be distributing to different workers as long as different tables is involed. A new global option "slave_pr_mode" is introduced, which can be configured as: 1. schema, distributing in schema mode, same as origial; 2. table, distributing in table mode. Note: if changed dynamically, please remember to restart SQL thread, i.e. "stop slave sql_thread; start slave sql_thread", to make the changes take effect.
- Loading branch information
AliSQL
authored and
AliSQL
committed
Dec 22, 2016
1 parent
c39ebbc
commit 945e59d
Showing
15 changed files
with
132 additions
and
7 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
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,36 @@ | ||
include/master-slave.inc | ||
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 1753 slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop. | ||
[connection master] | ||
reset master; | ||
create table t1(c int) engine=innodb; | ||
create table t2(c int) engine=innodb; | ||
create table t3(c int) engine=innodb; | ||
insert into t1 values(1); | ||
insert into t2 values(2); | ||
insert into t3 values(3); | ||
insert into t2 values(2); | ||
stop slave; | ||
change master to master_auto_position=1; | ||
start slave; | ||
Warnings: | ||
Note 1753 slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop. | ||
stop slave; | ||
set global relay_log_info_repository='FILE'; | ||
start slave; | ||
Warnings: | ||
Note 1753 slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop. | ||
insert into t3 values(3); | ||
drop table t3; | ||
drop table t2; | ||
drop table t1; | ||
stop slave; | ||
set global relay_log_info_repository='TABLE'; | ||
change master to master_auto_position=0; | ||
start slave; | ||
Warnings: | ||
Note 1753 slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop. | ||
include/rpl_end.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--log-bin --gtid-mode=on --enforce-gtid-consistency --log-slave-updates --binlog_format=row |
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 @@ | ||
--slave_pr_mode=TABLE --log-bin --gtid-mode=on --enforce-gtid-consistency --log-slave-updates --binlog_format=row --slave_parallel_workers=8 --master_info_repository=TABLE --relay_log_info_repository=TABLE |
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,35 @@ | ||
--source include/have_log_bin.inc | ||
--source include/master-slave.inc | ||
connection master; | ||
reset master; | ||
create table t1(c int) engine=innodb; | ||
create table t2(c int) engine=innodb; | ||
create table t3(c int) engine=innodb; | ||
insert into t1 values(1); | ||
insert into t2 values(2); | ||
insert into t3 values(3); | ||
insert into t2 values(2); | ||
|
||
connection slave; | ||
stop slave; | ||
change master to master_auto_position=1; | ||
start slave; | ||
|
||
connection master; | ||
--sync_slave_with_master | ||
|
||
stop slave; | ||
set global relay_log_info_repository='FILE'; | ||
|
||
start slave; | ||
connection master; | ||
insert into t3 values(3); | ||
drop table t3; | ||
drop table t2; | ||
drop table t1; | ||
--sync_slave_with_master | ||
stop slave; | ||
set global relay_log_info_repository='TABLE'; | ||
change master to master_auto_position=0; | ||
start slave; | ||
--source include/rpl_end.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--slave-transaction-retries=0 --relay-log-info-repository=TABLE --master-info-repository=TABLE | ||
--slave-transaction-retries=0 --relay-log-info-repository=TABLE --master-info-repository=TABLE --slave_pr_mode=schema |
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
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
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
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
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