forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding ability to apply binlogs thru mysqlbinlog in multi-threaded mode
Summary: Added a new flag in `mysqlbinlog` `--mta-workers=x` that tells the server to spawn `x` dependency applier workers to apply transactions. When `--mta-workers` is specified all events are printed in their base64 representation so we can create log events out of them. Differential Revision: D49466823 --------------------------------------------------------------------------- Cast enum into target type in a ternary operator (facebook#1411) Summary: This fixes a GCC build error: sql/rpl_replica.cc: In function ‘int slave_start_single_worker(Relay_log_info*, ulong)’: sql/rpl_replica.cc:7207:28: error: enumerated and non-enumerated type in conditional expression [-Werror=extra] 7207 | rli->is_fake() ? INFO_REPOSITORY_DUMMY : opt_rli_repository_id, i, | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pull Request resolved: facebook#1411 Differential Revision: D52207263 fbshipit-source-id: 47d7f5c
- Loading branch information
1 parent
36f8385
commit 7a4c1c4
Showing
21 changed files
with
398 additions
and
52 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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 connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
call mtr.add_suppression("HA_ERR_FOUND_DUPP_KEY"); | ||
create table t1 (a int primary key) engine = innodb; | ||
flush binary logs; | ||
purge binary logs to 'master-bin.000001'; | ||
insert into t1 values(1); | ||
insert into t1 values(2); | ||
insert into t1 values(3); | ||
insert into t1 values(4); | ||
include/sync_slave_sql_with_master.inc | ||
flush binary logs; | ||
delete from t1; | ||
"Case 1: No errors" | ||
include/sync_slave_sql_with_master.inc | ||
select * from t1; | ||
a | ||
1 | ||
2 | ||
3 | ||
4 | ||
select * from t1; | ||
a | ||
1 | ||
2 | ||
3 | ||
4 | ||
"Case 2: Duplicate key error on worker" | ||
delete from t1; | ||
insert into t1 values(3); | ||
include/sync_slave_sql_with_master.inc | ||
drop table t1; | ||
include/sync_slave_sql_with_master.inc | ||
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 @@ | ||
--enable-binlog-hlc |
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,49 @@ | ||
source include/master-slave.inc; | ||
source include/have_binlog_format_row.inc; | ||
|
||
call mtr.add_suppression("HA_ERR_FOUND_DUPP_KEY"); | ||
|
||
connection master; | ||
let $MYSQLD_DATADIR = `select @@global.datadir`; | ||
|
||
let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1); | ||
create table t1 (a int primary key) engine = innodb; | ||
|
||
flush binary logs; | ||
eval purge binary logs to '$binlog_file'; | ||
|
||
insert into t1 values(1); | ||
insert into t1 values(2); | ||
insert into t1 values(3); | ||
insert into t1 values(4); | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
connection master; | ||
let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1); | ||
|
||
flush binary logs; | ||
delete from t1; | ||
|
||
echo "Case 1: No errors"; | ||
exec $MYSQL_BINLOG --skip-gtids --mta-workers=2 $MYSQLD_DATADIR/$binlog_file | $MYSQL --host=127.0.0.1 -P $MASTER_MYPORT -uroot; | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
connection master; | ||
select * from t1; | ||
|
||
connection slave; | ||
select * from t1; | ||
|
||
echo "Case 2: Duplicate key error on worker"; | ||
connection master; | ||
delete from t1; | ||
insert into t1 values(3); # this will cause dup key error | ||
|
||
exec $MYSQL_BINLOG --skip-gtids --mta-workers=2 $MYSQLD_DATADIR/$binlog_file | $MYSQL --host=127.0.0.1 -P $MASTER_MYPORT -uroot || true; | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
connection master; | ||
drop table t1; | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
source include/rpl_end.inc; |
10 changes: 10 additions & 0 deletions
10
mysql-test/suite/sys_vars/r/mta_binlog_statement_workers_basic.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,10 @@ | ||
SET @start_value = @@global.mta_binlog_statement_workers; | ||
SELECT @start_value; | ||
@start_value | ||
0 | ||
SET @@GLOBAL.mta_binlog_statement_workers = 4; | ||
SET @@SESSION.mta_binlog_statement_workers = 4; | ||
SET @@SESSION.mta_binlog_statement_workers = 0; | ||
Warnings: | ||
Warning 1231 mta_binlog_statement_workers can only be set from mysqlbinlog | ||
SET @@GLOBAL.mta_binlog_statement_workers = @start_value; |
12 changes: 12 additions & 0 deletions
12
mysql-test/suite/sys_vars/t/mta_binlog_statement_workers_basic.test
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,12 @@ | ||
source include/load_sysvars.inc; | ||
|
||
SET @start_value = @@global.mta_binlog_statement_workers; | ||
SELECT @start_value; | ||
|
||
SET @@GLOBAL.mta_binlog_statement_workers = 4; | ||
|
||
SET @@SESSION.mta_binlog_statement_workers = 4; | ||
|
||
SET @@SESSION.mta_binlog_statement_workers = 0; | ||
|
||
SET @@GLOBAL.mta_binlog_statement_workers = @start_value; |
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
Oops, something went wrong.