1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

MDEV-6676: Optimistic parallel replication

Implement a new mode for parallel replication. In this mode, all transactions
are optimistically attempted applied in parallel. In case of conflicts, the
offending transaction is rolled back and retried later non-parallel.

This is an early-release patch to facilitate testing, more changes to user
interface / options will be expected. The new mode is not enabled by default.
This commit is contained in:
Kristian Nielsen
2014-12-05 16:09:48 +01:00
parent 1e3f09f163
commit db21fddc37
55 changed files with 2596 additions and 466 deletions

View File

@@ -66,6 +66,7 @@ if ($tmp)
--echo Gtid_IO_Pos #
--echo Replicate_Do_Domain_Ids
--echo Replicate_Ignore_Domain_Ids
--echo Parallel_Mode domain,follow_master_commit
}
if (!$tmp) {
# Note: after WL#5177, fields 13-18 shall not be filtered-out.

View File

@@ -920,6 +920,17 @@ The following options may be given as the first argument:
parallel replication thread when reading ahead in the
relay log looking for opportunities for parallel
replication. Only used when --slave-parallel-threads > 0.
--slave-parallel-mode=name
Controls what transactions are applied in parallel when
using --slave-parallel-threads. Syntax:
slave_parallel_mode=value[,value...], where "value" could
be one or more of: "domain", to apply different
replication domains in parallel; "follow_master_commit",
to apply in parallel transactions that group-committed
together on the master; "transactional", to
optimistically try to apply all transactional DML in
parallel; and "waiting" to extend "transactional" to even
transactions that had to wait on the master.
--slave-parallel-threads=#
If non-zero, number of threads to spawn to apply in
parallel events on the slave that were group-committed on
@@ -1341,6 +1352,7 @@ slave-exec-mode STRICT
slave-max-allowed-packet 1073741824
slave-net-timeout 3600
slave-parallel-max-queued 131072
slave-parallel-mode domain,follow_master_commit
slave-parallel-threads 0
slave-run-triggers-for-rbr NO
slave-skip-errors (No default value)

File diff suppressed because it is too large Load Diff

View File

@@ -2257,7 +2257,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -2364,7 +2365,7 @@ crn INT -- row number
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2 trans
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
BEGIN
/*!*/;
@@ -2457,7 +2458,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3 trans
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
BEGIN
/*!*/;
@@ -2550,7 +2551,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4 trans
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
BEGIN
/*!*/;
@@ -2726,7 +2727,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-5
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-5 trans
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
BEGIN
/*!*/;
@@ -2899,7 +2900,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-6
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-6 trans
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
BEGIN
/*!*/;
@@ -3072,7 +3073,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-7
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-7 trans
/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
BEGIN
/*!*/;
@@ -3245,7 +3246,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-8
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-8 trans
/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
BEGIN
/*!*/;
@@ -3418,7 +3419,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-9
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-9 trans
/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
BEGIN
/*!*/;
@@ -3511,7 +3512,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-10
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-10 trans
/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
BEGIN
/*!*/;
@@ -3604,7 +3605,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-11
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-11 trans
/*!100001 SET @@session.gtid_seq_no=11*//*!*/;
BEGIN
/*!*/;
@@ -3697,7 +3698,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-12
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-12 trans
/*!100001 SET @@session.gtid_seq_no=12*//*!*/;
BEGIN
/*!*/;
@@ -3890,7 +3891,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -3913,7 +3915,7 @@ crn INT -- row number
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2 trans
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
BEGIN
/*!*/;
@@ -3970,7 +3972,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3 trans
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
BEGIN
/*!*/;
@@ -4045,7 +4047,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4 trans
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
BEGIN
/*!*/;
@@ -4268,7 +4270,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -4291,7 +4294,7 @@ c_1_n INT -- row number
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -4303,7 +4306,7 @@ c_2_n INT -- row number
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -4315,7 +4318,7 @@ c_3_n INT -- row number
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4 trans
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
BEGIN
/*!*/;
@@ -4372,7 +4375,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-5
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-5 trans
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
BEGIN
/*!*/;
@@ -4429,7 +4432,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-6
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-6 trans
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
BEGIN
/*!*/;
@@ -4486,7 +4489,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-7
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-7 trans
/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
BEGIN
/*!*/;
@@ -4668,7 +4671,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-8
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-8 trans
/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
BEGIN
/*!*/;
@@ -4846,7 +4849,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -4869,7 +4873,7 @@ c3 VARCHAR(60)
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2 trans
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
BEGIN
/*!*/;

View File

@@ -2257,7 +2257,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -3913,7 +3914,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -4297,7 +4299,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -4320,7 +4323,7 @@ c_1_n INT -- row number
) ENGINE=MyISAM DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -4332,7 +4335,7 @@ c_2_n INT -- row number
) ENGINE=MyISAM DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -4885,7 +4888,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;

View File

@@ -136,7 +136,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -158,7 +159,7 @@ c2 VARCHAR(20)
) ENGINE=InnoDB DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -169,7 +170,7 @@ c2 VARCHAR(20)
) ENGINE=MyISAM DEFAULT CHARSET latin1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-3 trans
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
BEGIN
/*!*/;
@@ -226,7 +227,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -234,7 +235,7 @@ SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-5
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -321,7 +322,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-9
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-9 trans
/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
BEGIN
/*!*/;
@@ -378,7 +379,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-10
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-10 ddl
/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -386,7 +387,7 @@ SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-11
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-11 ddl
/*!100001 SET @@session.gtid_seq_no=11*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -473,7 +474,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-15
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-15 ddl
/*!100001 SET @@session.gtid_seq_no=15*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -481,7 +482,7 @@ SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-16
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-16 ddl
/*!100001 SET @@session.gtid_seq_no=16*//*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0

View File

@@ -80,7 +80,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -98,7 +99,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -106,7 +107,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -114,7 +115,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test3
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -122,7 +123,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -130,7 +131,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -332,7 +333,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -350,15 +352,15 @@ SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -366,11 +368,11 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
# at #
@@ -503,7 +505,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -521,7 +524,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -529,7 +532,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -537,7 +540,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test3
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -545,7 +548,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -553,7 +556,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -745,7 +748,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -763,7 +767,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -771,7 +775,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -779,7 +783,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test3
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -787,7 +791,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -795,7 +799,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -997,7 +1001,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -1015,15 +1020,15 @@ SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1031,11 +1036,11 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
# at #
@@ -1168,7 +1173,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -1186,7 +1192,7 @@ SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2
#010909 4:46:40 server id # end_log_pos # GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1194,7 +1200,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1202,7 +1208,7 @@ SET TIMESTAMP=1000000000/*!*/;
DROP DATABASE IF EXISTS test3
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4
#010909 4:46:40 server id # end_log_pos # GTID 0-1-4 ddl
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1210,7 +1216,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test1
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5
#010909 4:46:40 server id # end_log_pos # GTID 0-1-5 ddl
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1218,7 +1224,7 @@ SET TIMESTAMP=1000000000/*!*/;
CREATE DATABASE test2
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0

View File

@@ -40,7 +40,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -81,7 +82,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -128,7 +129,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
use `new_test3`/*!*/;
@@ -251,7 +252,8 @@ ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1
#010909 4:46:40 server id # end_log_pos # GTID 0-1-1 ddl
/*!100101 SET @@session.replicate_allow_parallel=1*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
@@ -292,7 +294,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3
#010909 4:46:40 server id # end_log_pos # GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -339,7 +341,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6
#010909 4:46:40 server id # end_log_pos # GTID 0-1-6 ddl
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
# at #
use `new_test3`/*!*/;

View File

@@ -84,17 +84,17 @@ MASTER 2.2
# EOF
#
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 relay.000002 601 master-bin.000001 Yes Yes 0 0 313 888 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000
MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 relay-master@00202@002e2.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 relay.000002 601 master-bin.000001 Yes Yes 0 0 313 888 None 0 No 0 No 0 0 1 No domain,follow_master_commit 0 1073741824 7 0 60.000
MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 relay-master@00202@002e2.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 7 0 60.000
include/wait_for_slave_to_start.inc
set default_master_connection = 'MASTER 2.2';
include/wait_for_slave_to_start.inc
set default_master_connection = '';
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 relay.000004 536 master-bin.000001 Yes Yes 0 0 313 823 None 0 No 0 No 0 0 1 No 0 1073741824 6 0 60.000
MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 relay-master@00202@002e2.000004 536 master-bin.000001 Yes Yes 0 0 313 842 None 0 No 0 No 0 0 2 No 0 1073741824 6 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 relay.000004 536 master-bin.000001 Yes Yes 0 0 313 823 None 0 No 0 No 0 0 1 No domain,follow_master_commit 0 1073741824 6 0 60.000
MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 relay-master@00202@002e2.000004 536 master-bin.000001 Yes Yes 0 0 313 842 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 6 0 60.000
#
# List of files matching '*info*' pattern
# after slave server restart

View File

@@ -10,14 +10,14 @@ start slave 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_start.inc
show slave 'master1' status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No domain,follow_master_commit
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No domain,follow_master_commit
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-master1.000002 601 master-bin.000001 Yes Yes 0 0 313 907 None 0 No 0 No 0 0 1 No domain,follow_master_commit 0 1073741824 7 0 60.000
drop database if exists db1;
create database db1;
use db1;
@@ -75,9 +75,9 @@ master_user='root';
start slave;
include/wait_for_slave_to_start.inc
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin.000002 601 master-bin.000001 Yes Yes 0 0 313 899 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 0-1-4
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 988 mysqld-relay-bin-master1.000002 1276 master-bin.000001 Yes Yes 0 0 988 1582 None 0 No 0 No 0 0 1 No 0 1073741824 17 0 60.000 0-1-4
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin.000002 601 master-bin.000001 Yes Yes 0 0 313 899 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 7 0 60.000 0-1-4
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 988 mysqld-relay-bin-master1.000002 1276 master-bin.000001 Yes Yes 0 0 988 1582 None 0 No 0 No 0 0 1 No domain,follow_master_commit 0 1073741824 17 0 60.000 0-1-4
insert into t1 (f1) values ('three');
drop database if exists db2;
create database db2;
@@ -105,9 +105,9 @@ master-bin.000002 367
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 921 mysqld-relay-bin.000002 1209 master-bin.000001 Yes Yes 0 0 921 1507 None 0 No 0 No 0 0 2 No 0 1073741824 17 0 60.000 0-1-7
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 740 mysqld-relay-bin-master1.000004 1028 master-bin.000002 Yes Yes 0 0 740 1378 None 0 No 0 No 0 0 1 No 0 1073741824 37 0 60.000 0-1-7
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 921 mysqld-relay-bin.000002 1209 master-bin.000001 Yes Yes 0 0 921 1507 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 17 0 60.000 0-1-7
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 740 mysqld-relay-bin-master1.000004 1028 master-bin.000002 Yes Yes 0 0 740 1378 None 0 No 0 No 0 0 1 No domain,follow_master_commit 0 1073741824 37 0 60.000 0-1-7
select * from db1.t1;
i f1
1 one

View File

@@ -10,15 +10,15 @@ create table t1 (i int) engine=MyISAM;
insert into t1 values (1),(2);
stop slave 'master1';
show slave 'master1' status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids
127.0.0.1 root MYPORT_1 60 master-bin.000001 802 mysqld-relay-bin-master1.000002 1090 master-bin.000001 No No 0 0 802 1396 None 0 No NULL No 0 0 1 No
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
127.0.0.1 root MYPORT_1 60 master-bin.000001 802 mysqld-relay-bin-master1.000002 1090 master-bin.000001 No No 0 0 802 1396 None 0 No NULL No 0 0 1 No domain,follow_master_commit
mysqld-relay-bin-master1.000001
mysqld-relay-bin-master1.000002
mysqld-relay-bin-master1.index
reset slave 'master1';
show slave 'master1' status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids
127.0.0.1 root MYPORT_1 60 4 1090 No No 0 0 0 1396 None 0 No NULL No 0 0 1 No
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
127.0.0.1 root MYPORT_1 60 4 1090 No No 0 0 0 1396 None 0 No NULL No 0 0 1 No domain,follow_master_commit
reset slave 'master1' all;
show slave 'master1' status;
ERROR HY000: There is no master connection 'master1'

View File

@@ -10,9 +10,9 @@ Note 1937 SLAVE 'slave2' started
include/wait_for_slave_to_start.inc
set default_master_connection = '';
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-slave1.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000
slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 313 mysqld-relay-bin-slave1.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 1 No domain,follow_master_commit 0 1073741824 7 0 60.000
slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 7 0 60.000
start all slaves;
stop slave 'slave1';
show slave 'slave1' status;
@@ -62,21 +62,22 @@ Using_Gtid No
Gtid_IO_Pos
Replicate_Do_Domain_Ids
Replicate_Ignore_Domain_Ids
Parallel_Mode domain,follow_master_commit
reset slave 'slave1';
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave1 127.0.0.1 root MYPORT_1 60 4 601 No No 0 0 0 906 None 0 No NULL No 0 0 1 No 0 1073741824 7 0 60.000
slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave1 127.0.0.1 root MYPORT_1 60 4 601 No No 0 0 0 906 None 0 No NULL No 0 0 1 No domain,follow_master_commit 0 1073741824 7 0 60.000
slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 7 0 60.000
reset slave 'slave1' all;
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 Yes Yes 0 0 313 906 None 0 No 0 No 0 0 2 No domain,follow_master_commit 0 1073741824 7 0 60.000
stop all slaves;
Warnings:
Note 1938 SLAVE 'slave2' stopped
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 No No 0 0 313 906 None 0 No NULL No 0 0 2 No 0 1073741824 7 0 60.000
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 313 mysqld-relay-bin-slave2.000002 601 master-bin.000001 No No 0 0 313 906 None 0 No NULL No 0 0 2 No domain,follow_master_commit 0 1073741824 7 0 60.000
stop all slaves;
include/reset_master_slave.inc
include/reset_master_slave.inc

View File

@@ -1,11 +1,11 @@
include/master-slave.inc
[connection master]
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
show slave '' status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode
show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
#
# Check error handling
#

View File

@@ -1,5 +1,5 @@
include/rpl_init.inc [topology=1->2]
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/master-slave.inc
[connection master]
SET GLOBAL slave_parallel_threads=10;
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
@@ -923,6 +923,61 @@ a
32
33
34
*** MDEV-6676 - test syntax of @@slave_parallel_mode ***
Parallel_Mode = 'domain,follow_master_commit'
include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit,transactional';
ERROR HY000: Invalid use of 'transactional' option for slave_parallel_mode
SET GLOBAL slave_parallel_mode='waiting,transactional,domain';
Parallel_Mode = 'domain,transactional,waiting'
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
Parallel_Mode = 'domain,follow_master_commit'
*** MDEV-6676 - test that empty parallel_mode does not replicate in parallel ***
INSERT INTO t2 VALUES (40);
include/save_master_gtid.inc
SET GLOBAL slave_parallel_mode='';
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply";
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
a
40
include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
*** MDEV-6676 - test disabling domain-based parallel replication ***
SET gtid_domain_id = 1;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
DELETE FROM t2 WHERE a >= 41;
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
SET gtid_domain_id = 0;
include/save_master_gtid.inc
SET GLOBAL slave_parallel_mode=follow_master_commit;
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
a
40
41
42
43
44
45
46
include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
include/start_slave.inc
*** MDEV-6775: Wrong binlog order in parallel replication ***
DELETE FROM t4;
INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6);
@@ -973,7 +1028,7 @@ SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc
*** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave ***
INSERT INTO t2 VALUES (40);
INSERT INTO t2 VALUES (50);
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=no;
SET @old_dbug= @@GLOBAL.debug_dbug;
@@ -981,41 +1036,41 @@ SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100";
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (51);
INSERT INTO t2 VALUES (52);
SET @old_format= @@binlog_format;
SET binlog_format= statement;
DELETE FROM t2 WHERE a=40;
DELETE FROM t2 WHERE a=50;
SET binlog_format= @old_format;
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (53);
INSERT INTO t2 VALUES (54);
FLUSH LOGS;
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (55);
SET gtid_seq_no=100;
INSERT INTO t2 VALUES (46);
INSERT INTO t2 VALUES (56);
BEGIN;
SELECT * FROM t2 WHERE a=40 FOR UPDATE;
SELECT * FROM t2 WHERE a=50 FOR UPDATE;
a
40
50
include/start_slave.inc
SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100';
STOP SLAVE;
SET debug_sync= 'now WAIT_FOR wait_for_done_waiting';
ROLLBACK;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
SELECT * FROM t2 WHERE a >= 50 ORDER BY a;
a
41
42
51
52
include/start_slave.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
SELECT * FROM t2 WHERE a >= 50 ORDER BY a;
a
41
42
43
44
45
46
51
52
53
54
55
56
include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
SET DEBUG_SYNC= 'RESET';
@@ -1024,7 +1079,7 @@ SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
include/start_slave.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
SET GLOBAL slave_parallel_threads=0;
include/start_slave.inc
SET DEBUG_SYNC= 'RESET';
DROP function foo;

View File

@@ -0,0 +1,164 @@
include/rpl_init.inc [topology=1->2->3->4]
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
*** MDEV-6676: Test that @@replicate_allow_parallel is preserved in slave binlog ***
INSERT INTO t1 VALUES(1,1);
BEGIN;
INSERT INTO t1 VALUES(2,1);
INSERT INTO t1 VALUES(3,1);
COMMIT;
SET SESSION replicate_allow_parallel=0;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
SET SESSION replicate_allow_parallel=1;
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 11
3 1
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 11
3 1
status
Ok, no retry
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 11
3 1
status
Ok, no retry
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 11
3 1
status
Ok, no retry
*** MDEV-6676: Test that the FL_WAITED flag in GTID is preserved in slave binlog ***
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='domain,transactional';
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='domain,transactional';
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='domain,transactional';
BEGIN;
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="thd_report_wait_for SIGNAL waiting1";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting1";
SET debug_sync="thd_report_wait_for SIGNAL waiting2";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting2";
SET debug_sync="thd_report_wait_for SIGNAL waiting3";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting3";
SET debug_sync="thd_report_wait_for SIGNAL waiting4";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting4";
SET debug_sync="thd_report_wait_for SIGNAL waiting5";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting5";
SET debug_sync="thd_report_wait_for SIGNAL waiting6";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting6";
SET debug_sync="thd_report_wait_for SIGNAL waiting7";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting7";
SET debug_sync="thd_report_wait_for SIGNAL waiting8";
UPDATE t1 SET b=b+1 WHERE a=2;
SET debug_sync="now WAIT_FOR waiting8";
COMMIT;
SET debug_sync="RESET";
COMMIT;
COMMIT;
COMMIT;
COMMIT;
COMMIT;
COMMIT;
COMMIT;
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 20
3 1
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 20
3 1
status
Ok, no retry
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 20
3 1
status
Ok, no retry
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 20
3 1
status
Ok, no retry
include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
DROP TABLE t1;
include/rpl_end.inc

View File

@@ -0,0 +1,295 @@
include/rpl_init.inc [topology=1->2]
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional';
INSERT INTO t1 VALUES(1,1);
BEGIN;
INSERT INTO t1 VALUES(2,1);
INSERT INTO t1 VALUES(3,1);
COMMIT;
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,2);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,3);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,4);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,5);
DELETE FROM t1 WHERE a=3;
INSERT INTO t1 VALUES(3,2);
DELETE FROM t1 WHERE a=1;
INSERT INTO t1 VALUES(1,2);
DELETE FROM t1 WHERE a=3;
INSERT INTO t1 VALUES(3,3);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,6);
include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 6
3 3
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 6
3 3
*** Test a bunch of non-transactional/DDL event groups. ***
include/stop_slave.inc
INSERT INTO t1 VALUES (4,4);
INSERT INTO t1 VALUES (5,5);
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1);
CREATE TABLE t3 (a INT PRIMARY KEY) ENGINE=MyISAM;
ALTER TABLE t2 ADD b INT;
INSERT INTO t2 VALUES (2,2);
ALTER TABLE t2 DROP b;
INSERT INTO t2 VALUES (3);
ALTER TABLE t2 ADD c INT;
INSERT INTO t2 VALUES (4,5);
INSERT INTO t2 VALUES (5,5);
INSERT INTO t3 VALUES (1);
UPDATE t2 SET c=NULL WHERE a=4;
ALTER TABLE t2 ADD UNIQUE (c);
INSERT INTO t2 VALUES (6,6);
UPDATE t2 SET c=c+100 WHERE a=2;
INSERT INTO t3(a) VALUES (2);
DELETE FROM t3 WHERE a=2;
INSERT INTO t3(a) VALUES (2);
DELETE FROM t3 WHERE a=2;
ALTER TABLE t3 CHANGE a c INT NOT NULL;
INSERT INTO t3(c) VALUES (2);
DELETE FROM t3 WHERE c=2;
INSERT INTO t3 SELECT a+200 FROM t2;
DELETE FROM t3 WHERE c >= 200;
INSERT INTO t3 SELECT a+200 FROM t2;
include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 6
3 3
4 4
5 5
SELECT * FROM t2 ORDER BY a;
a c
1 NULL
2 NULL
3 NULL
4 NULL
5 5
6 6
SELECT * FROM t3 ORDER BY c;
c
1
201
202
203
204
205
206
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 6
3 3
4 4
5 5
SELECT * FROM t2 ORDER BY a;
a c
1 NULL
2 NULL
3 NULL
4 NULL
5 5
6 6
SELECT * FROM t3 ORDER BY c;
c
1
201
202
203
204
205
206
*** Test @@replicate_allow_parallel. ***
include/stop_slave.inc
UPDATE t1 SET b=10 WHERE a=3;
SET SESSION replicate_allow_parallel=0;
UPDATE t1 SET b=20 WHERE a=3;
UPDATE t1 SET b=30 WHERE a=3;
UPDATE t1 SET b=50 WHERE a=3;
UPDATE t1 SET b=80 WHERE a=3;
UPDATE t1 SET b=130 WHERE a=3;
UPDATE t1 SET b=210 WHERE a=3;
UPDATE t1 SET b=340 WHERE a=3;
UPDATE t1 SET b=550 WHERE a=3;
UPDATE t1 SET b=890 WHERE a=3;
SET SESSION replicate_allow_parallel=1;
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 6
3 890
4 4
5 5
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 6
3 890
4 4
5 5
status
Ok, no retry
*** Test that we do not replicate in parallel transactions that had row lock waits on the master ***
include/stop_slave.inc
BEGIN;
UPDATE t1 SET b=b+1 WHERE a=3;
SET debug_sync='thd_report_wait_for SIGNAL waiting1';
UPDATE t1 SET b=1001 WHERE a=3;
SET debug_sync='now WAIT_FOR waiting1';
BEGIN;
UPDATE t1 SET b=1002 WHERE a=5;
SET debug_sync='thd_report_wait_for SIGNAL waiting2';
UPDATE t1 SET b=102 WHERE a=3;
SET debug_sync='now WAIT_FOR waiting2';
UPDATE t1 SET b=1000 WHERE a=1;
SET debug_sync='thd_report_wait_for SIGNAL waiting3';
UPDATE t1 SET b=1003 WHERE a=5;
SET debug_sync='now WAIT_FOR waiting3';
SET debug_sync='thd_report_wait_for SIGNAL waiting4';
UPDATE t1 SET b=1004 WHERE a=3;
SET debug_sync='now WAIT_FOR waiting4';
SET debug_sync='thd_report_wait_for SIGNAL waiting5';
UPDATE t1 SET b=1005 WHERE a=5;
SET debug_sync='now WAIT_FOR waiting5';
SET debug_sync='thd_report_wait_for SIGNAL waiting6';
UPDATE t1 SET b=1006 WHERE a=1;
SET debug_sync='now WAIT_FOR waiting6';
SET debug_sync='thd_report_wait_for SIGNAL waiting7';
UPDATE t1 SET b=1007 WHERE a=5;
SET debug_sync='now WAIT_FOR waiting7';
SET debug_sync='thd_report_wait_for SIGNAL waiting8';
UPDATE t1 SET b=1008 WHERE a=3;
SET debug_sync='now WAIT_FOR waiting8';
COMMIT;
COMMIT;
SET debug_sync='RESET';
SELECT * FROM t1 ORDER BY a;
a b
1 1006
2 6
3 1008
4 4
5 1007
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1006
2 6
3 1008
4 4
5 1007
status
Ok, no retry
*** Test that we replicate correctly when using READ COMMITTED and binlog_format=MIXED on the slave ***
include/stop_slave.inc
SET @old_format= @@GLOBAL.binlog_format;
SET GLOBAL binlog_format= MIXED;
SET @old_isolation= @@GLOBAL.tx_isolation;
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
DROP TABLE t1, t2;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,0), (2,0), (3,0);
INSERT INTO t2 VALUES (1,0), (2,0);
INSERT INTO t1 SELECT 4, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 4, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 5, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 5, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 6, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 6, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 7, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 7, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 8, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 8, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 9, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 9, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 10, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 10, COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY a;
a b
1 0
2 0
3 0
4 2
5 3
6 5
7 5
8 7
9 8
10 8
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 0
4 4
5 5
6 5
7 7
8 7
9 8
10 10
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 0
2 0
3 0
4 2
5 3
6 5
7 5
8 7
9 8
10 8
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 0
4 4
5 5
6 5
7 7
8 7
9 8
10 10
include/stop_slave.inc
SET GLOBAL binlog_format= @old_format;
SET GLOBAL tx_isolation= @old_isolation;
include/start_slave.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
DROP TABLE t1, t2, t3;
include/rpl_end.inc

View File

@@ -0,0 +1,85 @@
include/rpl_init.inc [topology=1->2]
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,0), (2,0), (3,0);
INSERT INTO t2 VALUES (1,0), (2,0);
SET @old_isolation= @@GLOBAL.tx_isolation;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
*** Test that we replicate correctly when using READ COMMITTED and --log-slave-updates=0 on the slave ***
INSERT INTO t1 SELECT 4, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 4, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 5, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 5, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 6, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 6, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 7, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 7, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 8, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 8, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 9, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 9, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 10, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 10, COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY a;
a b
1 0
2 0
3 0
4 2
5 3
6 5
7 5
8 7
9 8
10 8
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 0
4 4
5 5
6 5
7 7
8 7
9 8
10 10
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 0
2 0
3 0
4 2
5 3
6 5
7 5
8 7
9 8
10 8
SELECT * FROM t2 ORDER BY a;
a b
1 0
2 0
4 4
5 5
6 5
7 7
8 7
9 8
10 10
include/stop_slave.inc
SET GLOBAL tx_isolation= @old_isolation;
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
DROP TABLE t1, t2;
include/rpl_end.inc

View File

@@ -1,13 +1,12 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--source include/master-slave.inc
# Test various aspects of parallel replication.
--connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--let $old_parallel_threads=`SELECT @@GLOBAL.slave_parallel_threads`
--error ER_SLAVE_MUST_STOP
SET GLOBAL slave_parallel_threads=10;
--source include/stop_slave.inc
@@ -1466,6 +1465,71 @@ SET sql_slave_skip_counter= 1;
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
--echo *** MDEV-6676 - test syntax of @@slave_parallel_mode ***
--connection server_2
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--source include/stop_slave.inc
--error ER_INVALID_SLAVE_PARALLEL_MODE
SET GLOBAL slave_parallel_mode='domain,follow_master_commit,transactional';
SET GLOBAL slave_parallel_mode='waiting,transactional,domain';
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel ***
--connection server_1
INSERT INTO t2 VALUES (40);
--source include/save_master_gtid.inc
--connection server_2
SET GLOBAL slave_parallel_mode='';
# Test that we do not use parallel apply, by injecting an unconditional
# crash in the parallel apply code.
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply";
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
--echo *** MDEV-6676 - test disabling domain-based parallel replication ***
--connection server_1
# Let's do a bunch of transactions that will conflict if run out-of-order in
# domain-based parallel replication mode.
SET gtid_domain_id = 1;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
DELETE FROM t2 WHERE a >= 41;
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
SET gtid_domain_id = 0;
--source include/save_master_gtid.inc
--connection server_2
SET GLOBAL slave_parallel_mode=follow_master_commit;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
--source include/start_slave.inc
--echo *** MDEV-6775: Wrong binlog order in parallel replication ***
--connection server_1
# A bit tricky bug to reproduce. On the master, we binlog in statement-mode
@@ -1537,7 +1601,7 @@ SET GLOBAL slave_parallel_threads=10;
--echo *** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave ***
--connection server_1
INSERT INTO t2 VALUES (40);
INSERT INTO t2 VALUES (50);
--save_master_pos
--connection server_2
@@ -1558,28 +1622,28 @@ SET GLOBAL slave_parallel_threads=10;
--connection server_1
# Setup some transaction for the slave to replicate.
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (51);
INSERT INTO t2 VALUES (52);
# Need to log the DELETE in statement format, so we can see it in processlist.
SET @old_format= @@binlog_format;
SET binlog_format= statement;
DELETE FROM t2 WHERE a=40;
DELETE FROM t2 WHERE a=50;
SET binlog_format= @old_format;
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (53);
INSERT INTO t2 VALUES (54);
# Force the slave to switch to a new relay log file.
FLUSH LOGS;
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (55);
# Inject a GTID 0-1-100, which will trigger a DEBUG_SYNC signal when this
# transaction has been fetched by a worker thread.
SET gtid_seq_no=100;
INSERT INTO t2 VALUES (46);
INSERT INTO t2 VALUES (56);
--save_master_pos
--connection con_temp2
# Temporarily block the DELETE on a=40 from completing.
BEGIN;
SELECT * FROM t2 WHERE a=40 FOR UPDATE;
SELECT * FROM t2 WHERE a=50 FOR UPDATE;
--connection server_2
@@ -1587,7 +1651,7 @@ SELECT * FROM t2 WHERE a=40 FOR UPDATE;
# Wait for a worker thread to start on the DELETE that will be blocked
# temporarily by the SELECT FOR UPDATE.
--let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=40%'
--let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=50%'
--source include/wait_condition.inc
# The DBUG injection set above will make the worker thread signal the following
@@ -1620,13 +1684,13 @@ ROLLBACK;
--connection server_2
reap;
--source include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
SELECT * FROM t2 WHERE a >= 50 ORDER BY a;
# Now restart the slave. With the bug present, this would start at an
# incorrect relay log position, causing relay log read error (or if unlucky,
# silently skip a number of events).
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
SELECT * FROM t2 WHERE a >= 50 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
SET DEBUG_SYNC= 'RESET';
@@ -1639,7 +1703,7 @@ CHANGE MASTER TO master_use_gtid=slave_pos;
# Clean up.
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
eval SET GLOBAL slave_parallel_threads=$old_parallel_threads;
--source include/start_slave.inc
SET DEBUG_SYNC= 'RESET';

View File

@@ -0,0 +1,24 @@
!include ../my.cnf
[mysqld.1]
log-slave-updates
loose-innodb
[mysqld.2]
log-slave-updates
loose-innodb
[mysqld.3]
log-slave-updates
loose-innodb
[mysqld.4]
log-slave-updates
loose-innodb
[ENV]
SERVER_MYPORT_3= @mysqld.3.port
SERVER_MYSOCK_3= @mysqld.3.socket
SERVER_MYPORT_4= @mysqld.4.port
SERVER_MYSOCK_4= @mysqld.4.socket

View File

@@ -0,0 +1,284 @@
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--let $rpl_topology=1->2->3->4
--source include/rpl_init.inc
# Test parallel replication with a multi-level replication hierarchy.
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
--save_master_pos
--connection server_2
--sync_with_master
--save_master_pos
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
--connection server_3
--sync_with_master
--save_master_pos
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
--connection server_4
--sync_with_master
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
--echo *** MDEV-6676: Test that @@replicate_allow_parallel is preserved in slave binlog ***
--connection server_1
INSERT INTO t1 VALUES(1,1);
BEGIN;
INSERT INTO t1 VALUES(2,1);
INSERT INTO t1 VALUES(3,1);
COMMIT;
# Do a lot of updates on same row in sequence. These would be likely to cause
# conflicts and rollbacks in optimistic parallel replication, but we disable
# that by disabling @@replicate_allow_parallel. We can test that the flag is
# preserved down the replication hierarchy by checking that no slave retries
# are made.
SET SESSION replicate_allow_parallel=0;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
SET SESSION replicate_allow_parallel=1;
SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_3
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_4
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--echo *** MDEV-6676: Test that the FL_WAITED flag in GTID is preserved in slave binlog ***
--connection server_2
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='domain,transactional';
--connection server_3
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='domain,transactional';
--connection server_4
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='domain,transactional';
--connection server_1
# Do a lot of updates on same row in sequence. Ensure that all of these but the
# first have to do a lock wait on the master, setting FL_WAITED in the GTID
# event. This should cause all slaves to not attempt to run those updates in
# parallel with prior events, so that no retries are made.
BEGIN;
UPDATE t1 SET b=b+1 WHERE a=2;
--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting1";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting1";
--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting2";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting2";
--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting3";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting3";
--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting4";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting4";
--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting5";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting5";
--connect (con_temp6,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting6";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting6";
--connect (con_temp7,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting7";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting7";
--connect (con_temp8,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting8";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting8";
COMMIT;
SET debug_sync="RESET";
--connection con_temp1
reap;
COMMIT;
--connection con_temp2
reap;
COMMIT;
--connection con_temp3
reap;
COMMIT;
--connection con_temp4
reap;
COMMIT;
--connection con_temp5
reap;
COMMIT;
--connection con_temp6
reap;
COMMIT;
--connection con_temp7
reap;
COMMIT;
--connection con_temp8
reap;
--connection server_1
SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_3
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_4
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
# Clean up
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_3
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_4
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_1
DROP TABLE t1;
--source include/rpl_end.inc

View File

@@ -0,0 +1,319 @@
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
--save_master_pos
--connection server_2
--sync_with_master
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional';
--connection server_1
INSERT INTO t1 VALUES(1,1);
BEGIN;
INSERT INTO t1 VALUES(2,1);
INSERT INTO t1 VALUES(3,1);
COMMIT;
# Do a bunch of INSERT/DELETE on the same rows, bound to conflict.
# We will get a lot of rollbacks, probably, but they should be handled without
# any visible errors.
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,2);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,3);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,4);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,5);
DELETE FROM t1 WHERE a=3;
INSERT INTO t1 VALUES(3,2);
DELETE FROM t1 WHERE a=1;
INSERT INTO t1 VALUES(1,2);
DELETE FROM t1 WHERE a=3;
INSERT INTO t1 VALUES(3,3);
DELETE FROM t1 WHERE a=2;
INSERT INTO t1 VALUES (2,6);
--source include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--connection server_2
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
#SHOW STATUS LIKE 'Slave_retried_transactions';
--echo *** Test a bunch of non-transactional/DDL event groups. ***
--connection server_2
--source include/stop_slave.inc
--connection server_1
INSERT INTO t1 VALUES (4,4);
INSERT INTO t1 VALUES (5,5);
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1);
CREATE TABLE t3 (a INT PRIMARY KEY) ENGINE=MyISAM;
ALTER TABLE t2 ADD b INT;
INSERT INTO t2 VALUES (2,2);
ALTER TABLE t2 DROP b;
INSERT INTO t2 VALUES (3);
ALTER TABLE t2 ADD c INT;
INSERT INTO t2 VALUES (4,5);
INSERT INTO t2 VALUES (5,5);
INSERT INTO t3 VALUES (1);
UPDATE t2 SET c=NULL WHERE a=4;
ALTER TABLE t2 ADD UNIQUE (c);
INSERT INTO t2 VALUES (6,6);
UPDATE t2 SET c=c+100 WHERE a=2;
INSERT INTO t3(a) VALUES (2);
DELETE FROM t3 WHERE a=2;
INSERT INTO t3(a) VALUES (2);
DELETE FROM t3 WHERE a=2;
ALTER TABLE t3 CHANGE a c INT NOT NULL;
INSERT INTO t3(c) VALUES (2);
DELETE FROM t3 WHERE c=2;
INSERT INTO t3 SELECT a+200 FROM t2;
DELETE FROM t3 WHERE c >= 200;
INSERT INTO t3 SELECT a+200 FROM t2;
--source include/save_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY c;
--connection server_2
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
SELECT * FROM t3 ORDER BY c;
#SHOW STATUS LIKE 'Slave_retried_transactions';
--echo *** Test @@replicate_allow_parallel. ***
--connection server_2
--source include/stop_slave.inc
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--connection server_1
# We do a bunch of conflicting transactions on the master with
# replicate_allow_parallel set to false, and check that we do not
# get any retries on the slave.
UPDATE t1 SET b=10 WHERE a=3;
SET SESSION replicate_allow_parallel=0;
UPDATE t1 SET b=20 WHERE a=3;
UPDATE t1 SET b=30 WHERE a=3;
UPDATE t1 SET b=50 WHERE a=3;
UPDATE t1 SET b=80 WHERE a=3;
UPDATE t1 SET b=130 WHERE a=3;
UPDATE t1 SET b=210 WHERE a=3;
UPDATE t1 SET b=340 WHERE a=3;
UPDATE t1 SET b=550 WHERE a=3;
UPDATE t1 SET b=890 WHERE a=3;
SET SESSION replicate_allow_parallel=1;
SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--echo *** Test that we do not replicate in parallel transactions that had row lock waits on the master ***
--connection server_2
--source include/stop_slave.inc
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--connection server_1
# Setup a bunch of transactions that all needed to wait.
--connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m2,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m3,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m4,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m5,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m6,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m7,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connect (m8,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
--connection default
BEGIN; UPDATE t1 SET b=b+1 WHERE a=3;
--connection m1
SET debug_sync='thd_report_wait_for SIGNAL waiting1';
send UPDATE t1 SET b=1001 WHERE a=3;
--connection default
SET debug_sync='now WAIT_FOR waiting1';
--connection m2
BEGIN;
UPDATE t1 SET b=1002 WHERE a=5;
SET debug_sync='thd_report_wait_for SIGNAL waiting2';
send UPDATE t1 SET b=102 WHERE a=3;
--connection default
SET debug_sync='now WAIT_FOR waiting2';
UPDATE t1 SET b=1000 WHERE a=1;
--connection m3
SET debug_sync='thd_report_wait_for SIGNAL waiting3';
send UPDATE t1 SET b=1003 WHERE a=5;
--connection default
SET debug_sync='now WAIT_FOR waiting3';
--connection m4
SET debug_sync='thd_report_wait_for SIGNAL waiting4';
send UPDATE t1 SET b=1004 WHERE a=3;
--connection default
SET debug_sync='now WAIT_FOR waiting4';
--connection m5
SET debug_sync='thd_report_wait_for SIGNAL waiting5';
send UPDATE t1 SET b=1005 WHERE a=5;
--connection default
SET debug_sync='now WAIT_FOR waiting5';
--connection m6
SET debug_sync='thd_report_wait_for SIGNAL waiting6';
send UPDATE t1 SET b=1006 WHERE a=1;
--connection default
SET debug_sync='now WAIT_FOR waiting6';
--connection m7
SET debug_sync='thd_report_wait_for SIGNAL waiting7';
send UPDATE t1 SET b=1007 WHERE a=5;
--connection default
SET debug_sync='now WAIT_FOR waiting7';
--connection m8
SET debug_sync='thd_report_wait_for SIGNAL waiting8';
send UPDATE t1 SET b=1008 WHERE a=3;
--connection default
SET debug_sync='now WAIT_FOR waiting8';
--connection default
COMMIT;
--connection m1
REAP;
--connection m2
REAP;
COMMIT;
--connection m3
REAP;
--connection m4
REAP;
--connection m5
REAP;
--connection m6
REAP;
--connection m7
REAP;
--connection m8
REAP;
--connection default
SET debug_sync='RESET';
SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--echo *** Test that we replicate correctly when using READ COMMITTED and binlog_format=MIXED on the slave ***
--connection server_2
--source include/stop_slave.inc
SET @old_format= @@GLOBAL.binlog_format;
# Use MIXED format; we cannot binlog ROW events on slave in STATEMENT format.
SET GLOBAL binlog_format= MIXED;
SET @old_isolation= @@GLOBAL.tx_isolation;
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
# Reset the worker threads to make the new settings take effect.
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
--connection server_1
DROP TABLE t1, t2;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,0), (2,0), (3,0);
INSERT INTO t2 VALUES (1,0), (2,0);
INSERT INTO t1 SELECT 4, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 4, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 5, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 5, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 6, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 6, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 7, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 7, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 8, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 8, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 9, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 9, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 10, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 10, COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL binlog_format= @old_format;
SET GLOBAL tx_isolation= @old_isolation;
--source include/start_slave.inc
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_1
DROP TABLE t1, t2, t3;
--source include/rpl_end.inc

View File

@@ -0,0 +1,9 @@
!include ../my.cnf
[mysqld.1]
log-slave-updates=0
loose-innodb
[mysqld.2]
log-slave-updates=0
loose-innodb

View File

@@ -0,0 +1,74 @@
--source include/have_innodb.inc
--source include/have_binlog_format_statement.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,0), (2,0), (3,0);
INSERT INTO t2 VALUES (1,0), (2,0);
--save_master_pos
--connection server_2
--sync_with_master
SET @old_isolation= @@GLOBAL.tx_isolation;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
--echo *** Test that we replicate correctly when using READ COMMITTED and --log-slave-updates=0 on the slave ***
--connection server_1
INSERT INTO t1 SELECT 4, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 4, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 5, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 5, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 6, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 6, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 7, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 7, COUNT(*) FROM t1;
INSERT INTO t2 SELECT 8, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 8, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 9, COUNT(*) FROM t1;
INSERT INTO t1 SELECT 9, COUNT(*) FROM t2;
INSERT INTO t1 SELECT 10, COUNT(*) FROM t2;
INSERT INTO t2 SELECT 10, COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--connection server_2
--source include/stop_slave.inc
SET GLOBAL tx_isolation= @old_isolation;
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_1
DROP TABLE t1, t2;
--source include/rpl_end.inc

View File

@@ -0,0 +1,15 @@
SELECT @@global.replicate_allow_parallel;
ERROR HY000: Variable 'replicate_allow_parallel' is a SESSION variable
SET GLOBAL replicate_allow_parallel= 1;
ERROR HY000: Variable 'replicate_allow_parallel' is a SESSION variable and can't be used with SET GLOBAL
SELECT @@session.replicate_allow_parallel;
@@session.replicate_allow_parallel
1
SET SESSION replicate_allow_parallel= 0;
SELECT @@session.replicate_allow_parallel;
@@session.replicate_allow_parallel
0
SET SESSION replicate_allow_parallel= 1;
SELECT @@session.replicate_allow_parallel;
@@session.replicate_allow_parallel
1

View File

@@ -0,0 +1,41 @@
SET SESSION slave_parallel_mode= '';
ERROR HY000: Variable 'slave_parallel_mode' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@slave_parallel_mode;
@@slave_parallel_mode
domain
SELECT @@m1.slave_parallel_mode;
ERROR HY000: There is no master connection 'm1'
CHANGE MASTER TO master_host='127.0.0.1', master_port=3310, master_user='root';
SELECT @@``.slave_parallel_mode;
@@``.slave_parallel_mode
domain
SELECT @@slave_parallel_mode;
@@slave_parallel_mode
domain
Parallel_Mode = 'domain'
SELECT @@m2.slave_parallel_mode;
ERROR HY000: There is no master connection 'm2'
SET GLOBAL m2.slave_parallel_mode = '';
ERROR HY000: There is no master connection 'm2'
CHANGE MASTER 'm1' TO master_host='127.0.0.1', master_port=3311, master_user='root';
SELECT @@m1.slave_parallel_mode;
@@m1.slave_parallel_mode
transactional
Parallel_Mode = 'domain'
SET GLOBAL m1.slave_parallel_mode= follow_master_commit;
Parallel_Mode = 'domain'
SET default_master_connection= 'm1';
SELECT @@slave_parallel_mode;
@@slave_parallel_mode
follow_master_commit
SET GLOBAL slave_parallel_mode= waiting;
SELECT @@slave_parallel_mode;
@@slave_parallel_mode
waiting
Parallel_Mode = 'waiting'
SET default_master_connection= '';
SELECT @@slave_parallel_mode;
@@slave_parallel_mode
domain
RESET SLAVE ALL;
RESET SLAVE 'm1' ALL;

View File

@@ -3395,6 +3395,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME REPLICATE_ALLOW_PARALLEL
SESSION_VALUE ON
GLOBAL_VALUE NULL
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE ON
VARIABLE_SCOPE SESSION ONLY
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT If set when a transaction is written to the binlog, that transaction is allowed to replicate in parallel on a slave where slave_parallel_mode is set to "transactional". Can be cleared for transactions that are likely to cause a conflict if replicated in parallel, to avoid unnecessary rollback and retry.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME REPLICATE_ANNOTATE_ROW_EVENTS
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -3801,6 +3815,20 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_PARALLEL_MODE
SESSION_VALUE NULL
GLOBAL_VALUE domain,follow_master_commit
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE domain,follow_master_commit
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE SET
VARIABLE_COMMENT Controls what transactions are applied in parallel when using --slave-parallel-threads. Syntax: slave_parallel_mode=value[,value...], where "value" could be one or more of: "domain", to apply different replication domains in parallel; "follow_master_commit", to apply in parallel transactions that group-committed together on the master; "transactional", to optimistically try to apply all transactional DML in parallel; and "waiting" to extend "transactional" to even transactions that had to wait on the master.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST domain,follow_master_commit,transactional,waiting
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME SLAVE_PARALLEL_THREADS
SESSION_VALUE NULL
GLOBAL_VALUE 0

View File

@@ -0,0 +1,14 @@
--source include/not_embedded.inc
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@global.replicate_allow_parallel;
--error ER_LOCAL_VARIABLE
SET GLOBAL replicate_allow_parallel= 1;
SELECT @@session.replicate_allow_parallel;
SET SESSION replicate_allow_parallel= 0;
SELECT @@session.replicate_allow_parallel;
SET SESSION replicate_allow_parallel= 1;
SELECT @@session.replicate_allow_parallel;
# More testing of the actual functionality in rpl.rpl_parallel_* tests.

View File

@@ -0,0 +1 @@
--slave-parallel-mode=domain --m1.slave-parallel-mode=transactional --m2.slave-parallel-mode=domain,follow_master_commit,waiting

View File

@@ -0,0 +1,38 @@
--source include/not_embedded.inc
# Also tests some command line options, in slave_parallel_mode_basic-master.opt
--error ER_GLOBAL_VARIABLE
SET SESSION slave_parallel_mode= '';
SELECT @@slave_parallel_mode;
--error WARN_NO_MASTER_INFO
SELECT @@m1.slave_parallel_mode;
CHANGE MASTER TO master_host='127.0.0.1', master_port=3310, master_user='root';
SELECT @@``.slave_parallel_mode;
SELECT @@slave_parallel_mode;
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--error WARN_NO_MASTER_INFO
SELECT @@m2.slave_parallel_mode;
--error WARN_NO_MASTER_INFO
SET GLOBAL m2.slave_parallel_mode = '';
CHANGE MASTER 'm1' TO master_host='127.0.0.1', master_port=3311, master_user='root';
SELECT @@m1.slave_parallel_mode;
--source include/show_slave_status.inc
SET GLOBAL m1.slave_parallel_mode= follow_master_commit;
--source include/show_slave_status.inc
SET default_master_connection= 'm1';
SELECT @@slave_parallel_mode;
SET GLOBAL slave_parallel_mode= waiting;
SELECT @@slave_parallel_mode;
--source include/show_slave_status.inc
SET default_master_connection= '';
SELECT @@slave_parallel_mode;
RESET SLAVE ALL;
RESET SLAVE 'm1' ALL;

View File

@@ -1422,7 +1422,11 @@ struct THD_TRANS
*/
bool modified_non_trans_table;
void reset() { no_2pc= FALSE; modified_non_trans_table= FALSE; }
void reset() {
no_2pc= FALSE;
modified_non_trans_table= FALSE;
m_unsafe_rollback_flags= 0;
}
bool is_empty() const { return ha_list == NULL; }
THD_TRANS() {} /* Remove gcc warning */
@@ -1434,12 +1438,17 @@ struct THD_TRANS
static unsigned int const MODIFIED_NON_TRANS_TABLE= 0x01;
static unsigned int const CREATED_TEMP_TABLE= 0x02;
static unsigned int const DROPPED_TEMP_TABLE= 0x04;
static unsigned int const DID_WAIT= 0x08;
void mark_created_temp_table()
{
DBUG_PRINT("debug", ("mark_created_temp_table"));
m_unsafe_rollback_flags|= CREATED_TEMP_TABLE;
}
void mark_trans_did_wait() { m_unsafe_rollback_flags|= DID_WAIT; }
bool trans_did_wait() const {
return (m_unsafe_rollback_flags & DID_WAIT) != 0;
}
};

View File

@@ -187,6 +187,8 @@ is_parallel_retry_error(rpl_group_info *rgi, int err)
{
if (!rgi->is_parallel_exec)
return false;
if (rgi->speculation == rpl_group_info::SPECULATE_OPTIMISTIC)
return true;
if (rgi->killed_for_retry &&
(err == ER_QUERY_INTERRUPTED || err == ER_CONNECTION_KILLED))
return true;
@@ -6382,6 +6384,18 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
flags2((standalone ? FL_STANDALONE : 0) | (commit_id_arg ? FL_GROUP_COMMIT_ID : 0))
{
cache_type= Log_event::EVENT_NO_CACHE;
if (thd_arg->transaction.stmt.trans_did_wait() ||
thd_arg->transaction.all.trans_did_wait())
flags2|= FL_WAITED;
if (sql_command_flags[thd->lex->sql_command] & CF_DISALLOW_IN_RO_TRANS)
flags2|= FL_DDL;
else if (is_transactional)
flags2|= FL_TRANSACTIONAL;
if (thd_arg->variables.option_bits & OPTION_RPL_ALLOW_PARALLEL)
flags2|= FL_ALLOW_PARALLEL;
/* Preserve any DDL or WAITED flag in the slave's binlog. */
if (thd_arg->rgi_slave)
flags2|= (thd_arg->rgi_slave->gtid_ev_flags2 & (FL_DDL|FL_WAITED));
}
@@ -6501,9 +6515,11 @@ static char gtid_begin_string[] = "BEGIN";
int
Gtid_log_event::do_apply_event(rpl_group_info *rgi)
{
ulonglong bits= thd->variables.option_bits;
thd->variables.server_id= this->server_id;
thd->variables.gtid_domain_id= this->domain_id;
thd->variables.gtid_seq_no= this->seq_no;
rgi->gtid_ev_flags2= flags2;
mysql_reset_thd_for_next_command(thd);
if (opt_gtid_strict_mode && opt_bin_log && opt_log_slave_updates)
@@ -6513,12 +6529,17 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
return 1;
}
DBUG_ASSERT((thd->variables.option_bits & OPTION_GTID_BEGIN) == 0);
DBUG_ASSERT((bits & OPTION_GTID_BEGIN) == 0);
if (flags2 & FL_STANDALONE)
return 0;
/* Execute this like a BEGIN query event. */
thd->variables.option_bits|= OPTION_GTID_BEGIN;
bits|= OPTION_GTID_BEGIN;
if (flags2 & FL_ALLOW_PARALLEL)
bits|= (ulonglong)OPTION_RPL_ALLOW_PARALLEL;
else
bits&= ~(ulonglong)OPTION_RPL_ALLOW_PARALLEL;
thd->variables.option_bits= bits;
DBUG_PRINT("info", ("Set OPTION_GTID_BEGIN"));
thd->set_query_and_id(gtid_begin_string, sizeof(gtid_begin_string)-1,
&my_charset_bin, next_query_id());
@@ -6590,14 +6611,29 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
{
print_header(&cache, print_event_info, FALSE);
longlong10_to_str(seq_no, buf, 10);
my_b_printf(&cache, "\tGTID %u-%u-%s", domain_id, server_id, buf);
if (flags2 & FL_GROUP_COMMIT_ID)
{
longlong10_to_str(commit_id, buf2, 10);
my_b_printf(&cache, "\tGTID %u-%u-%s cid=%s\n",
domain_id, server_id, buf, buf2);
my_b_printf(&cache, " cid=%s", buf2);
}
if (flags2 & FL_DDL)
my_b_write_string(&cache, " ddl");
if (flags2 & FL_TRANSACTIONAL)
my_b_write_string(&cache, " trans");
if (flags2 & FL_WAITED)
my_b_write_string(&cache, " waited");
my_b_printf(&cache, "\n");
if (!print_event_info->allow_parallel_printed ||
print_event_info->allow_parallel != !!(flags2 & FL_ALLOW_PARALLEL))
{
my_b_printf(&cache,
"/*!100101 SET @@session.replicate_allow_parallel=%u*/%s\n",
!!(flags2 & FL_ALLOW_PARALLEL), print_event_info->delimiter);
print_event_info->allow_parallel= !!(flags2 & FL_ALLOW_PARALLEL);
print_event_info->allow_parallel_printed= true;
}
else
my_b_printf(&cache, "\tGTID %u-%u-%s\n", domain_id, server_id, buf);
if (!print_event_info->domain_id_printed ||
print_event_info->domain_id != domain_id)
@@ -9600,6 +9636,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
by mysql_reset_thd_for_next_command.
*/
thd->transaction.stmt.modified_non_trans_table= FALSE;
thd->transaction.stmt.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
/*
This is a row injection, so we flag the "statement" as
such. Note that this code is called both when the slave does row
@@ -10058,7 +10095,10 @@ static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD * thd)
rows_log_event::do_apply_event()
*/
if (!thd->in_multi_stmt_transaction_mode())
{
thd->transaction.all.modified_non_trans_table= 0;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
}
rgi->cleanup_context(thd, 0);
}
@@ -12625,7 +12665,7 @@ st_print_event_info::st_print_event_info()
charset_database_number(ILLEGAL_CHARSET_INFO_NUMBER),
thread_id(0), thread_id_printed(false), server_id(0),
server_id_printed(false), domain_id(0), domain_id_printed(false),
skip_replication(0),
allow_parallel(true), allow_parallel_printed(false), skip_replication(0),
base64_output_mode(BASE64_OUTPUT_UNSPEC), printed_fd_event(FALSE)
{
/*
@@ -12675,7 +12715,7 @@ bool rpl_get_position_info(const char **log_file_name, ulonglong *log_pos,
return FALSE;
#else
const Relay_log_info *rli= &(active_mi->rli);
if (opt_slave_parallel_threads == 0)
if (!rli->mi->using_parallel())
{
*log_file_name= rli->group_master_log_name;
*log_pos= rli->group_master_log_pos +

View File

@@ -804,6 +804,8 @@ typedef struct st_print_event_info
bool server_id_printed;
uint32 domain_id;
bool domain_id_printed;
bool allow_parallel;
bool allow_parallel_printed;
/*
Track when @@skip_replication changes so we need to output a SET
@@ -3131,6 +3133,12 @@ public:
<td>1 byte bitfield</td>
<td>Bit 0 set indicates stand-alone event (no terminating COMMIT)</td>
<td>Bit 1 set indicates group commit, and that commit id exists</td>
<td>Bit 2 set indicates a transactional event group (can be safely rolled
back).</td>
<td>Bit 3 set indicates that user allowed optimistic parallel apply (the
@@SESSION.replicate_allow_parallel value was true at commit).</td>
<td>Bit 4 set indicates that this transaction encountered a row (or other)
lock wait during execution.</td>
</tr>
<tr>
@@ -3163,6 +3171,23 @@ public:
master. Groups with same commit_id are part of the same group commit.
*/
static const uchar FL_GROUP_COMMIT_ID= 2;
/*
FL_TRANSACTIONAL is set for an event group that can be safely rolled back
(no MyISAM, eg.).
*/
static const uchar FL_TRANSACTIONAL= 4;
/*
FL_ALLOW_PARALLEL reflects the value of @@SESSION.replicate_allow_parallel
at the time of commit.
*/
static const uchar FL_ALLOW_PARALLEL= 8;
/*
FL_WAITED is set if a row lock wait (or other wait) is detected during the
execution of the transaction.
*/
static const uchar FL_WAITED= 16;
/* FL_DDL is set for event group containing DDL. */
static const uchar FL_DDL= 32;
#ifdef MYSQL_SERVER
Gtid_log_event(THD *thd_arg, uint64 seq_no, uint32 domain_id, bool standalone,

View File

@@ -567,6 +567,8 @@ ulong stored_program_cache_size= 0;
ulong opt_slave_parallel_threads= 0;
ulong opt_slave_domain_parallel_threads= 0;
ulonglong opt_slave_parallel_mode=
SLAVE_PARALLEL_DOMAIN | SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT;
ulong opt_binlog_commit_wait_count= 0;
ulong opt_binlog_commit_wait_usec= 0;
ulong opt_slave_parallel_max_queued= 131072;
@@ -2119,6 +2121,7 @@ void clean_up(bool print_message)
free_all_rpl_filters();
#ifdef HAVE_REPLICATION
end_slave_list();
mi_cmdline_destroy();
#endif
my_uuid_end();
delete binlog_filter;
@@ -7317,6 +7320,20 @@ struct my_option my_long_options[]=
{"skip-slave-start", 0,
"If set, slave is not autostarted.", &opt_skip_slave_start,
&opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"slave-parallel-mode", OPT_SLAVE_PARALLEL_MODE,
"Controls what transactions are applied in parallel when using "
"--slave-parallel-threads. Syntax: slave_parallel_mode=value[,value...], "
"where \"value\" could be one or more of: \"domain\", to apply different "
"replication domains in parallel; \"follow_master_commit\", to apply "
"in parallel transactions that group-committed together on the master; "
"\"transactional\", to optimistically try to apply all transactional "
"DML in parallel; and \"waiting\" to extend \"transactional\" to "
"even transactions that had to wait on the master.",
&opt_slave_parallel_mode, &opt_slave_parallel_mode,
&slave_parallel_mode_typelib, GET_SET | GET_ASK_ADDR, REQUIRED_ARG,
SLAVE_PARALLEL_DOMAIN | SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT, 0, 0, 0, 0, 0},
#endif
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
{"slow-start-timeout", 0,
"Maximum number of milliseconds that the service control manager should wait "
@@ -9029,6 +9046,24 @@ mysql_getopt_value(const char *name, uint length,
}
return 0;
}
#ifdef HAVE_REPLICATION
case OPT_SLAVE_PARALLEL_MODE:
{
ulonglong *ptr;
LEX_STRING connection_name;
if (!length)
return &opt_slave_parallel_mode;
connection_name.str= const_cast<char *>(name);
connection_name.length= length;
if (mi_slave_parallel_mode_ptr(&connection_name, &ptr, true))
{
if (error)
*error= EXIT_OUT_OF_MEMORY;
return NULL;
}
return ptr;
}
#endif
}
return option->value;
}

View File

@@ -184,6 +184,7 @@ extern ulong stored_program_cache_size;
extern ulong opt_slave_parallel_threads;
extern ulong opt_slave_domain_parallel_threads;
extern ulong opt_slave_parallel_max_queued;
extern ulonglong opt_slave_parallel_mode;
extern ulong opt_binlog_commit_wait_count;
extern ulong opt_binlog_commit_wait_usec;
extern my_bool opt_gtid_ignore_duplicates;
@@ -586,6 +587,7 @@ enum options_mysqld
OPT_SERVER_ID,
OPT_SKIP_HOST_CACHE,
OPT_SKIP_RESOLVE,
OPT_SLAVE_PARALLEL_MODE,
OPT_SSL_CA,
OPT_SSL_CAPATH,
OPT_SSL_CERT,

View File

@@ -72,6 +72,8 @@ Master_info::Master_info(LEX_STRING *connection_name_arg,
connection_name.length);
copy_filter_setting(rpl_filter, global_rpl_filter);
mi_slave_parallel_mode_lookup(&connection_name, &parallel_mode);
my_init_dynamic_array(&ignore_server_ids,
sizeof(global_system_variables.server_id), 16, 16,
MYF(0));
@@ -176,6 +178,7 @@ void init_master_log_pos(Master_info* mi)
mi->events_queued_since_last_gtid= 0;
mi->gtid_reconnect_event_skip_count= 0;
mi->gtid_event_seen= false;
mi_slave_parallel_mode_lookup(&mi->connection_name, &mi->parallel_mode);
/* Intentionally init ssl_verify_server_cert to 0, no option available */
mi->ssl_verify_server_cert= 0;
@@ -587,6 +590,14 @@ file '%s')", fname);
}
continue;
}
else if (!strncmp(buf, STRING_WITH_LEN("END_MARKER")))
{
/*
Guard agaist extra left-overs at the end of file, in case a later
update causes the file to shrink compared to earlier contents.
*/
break;
}
}
}
}
@@ -750,7 +761,8 @@ int flush_master_info(Master_info* mi,
"\n\n\n\n\n\n\n\n\n\n\n"
"using_gtid=%d\n"
"do_domain_ids=%s\n"
"ignore_domain_ids=%s\n",
"ignore_domain_ids=%s\n"
"END_MARKER\n",
LINES_IN_MASTER_INFO,
mi->master_log_name, llstr(mi->master_log_pos, lbuf),
mi->host, mi->user,
@@ -1703,4 +1715,165 @@ void prot_store_ids(THD *thd, DYNAMIC_ARRAY *ids)
return;
}
/*
We need to handle per-Master_info command line options special.
Because when command line options are parsed, we do not yet have any
Master_info objects.
*/
static HASH mi_cmdline_hash;
static bool mi_cmdline_hash_inited= false;
struct mi_cmdline_entry {
LEX_STRING cmp_connection_name;
ulonglong parallel_mode;
};
static uchar *
get_key_cmdline(const uchar *ptr, size_t *length_p,
my_bool unused __attribute__((unused)))
{
mi_cmdline_entry *entry= (mi_cmdline_entry *)ptr;
*length_p= entry->cmp_connection_name.length;
return (uchar *)entry->cmp_connection_name.str;
}
static void
free_key_cmdline(void *ptr)
{
mi_cmdline_entry *entry= (mi_cmdline_entry *)ptr;
my_free(entry->cmp_connection_name.str);
my_free(entry);
}
int
mi_cmdline_init()
{
if (mi_cmdline_hash_inited)
return 0;
if (my_hash_init(&mi_cmdline_hash, system_charset_info,
MAX_REPLICATION_THREAD, 0, 0, get_key_cmdline,
free_key_cmdline, HASH_UNIQUE))
{
sql_print_error("Initializing Master_info command line option hash table failed");
return 1;
}
mi_cmdline_hash_inited= true;
return 0;
}
void
mi_cmdline_destroy()
{
if (mi_cmdline_hash_inited)
my_hash_free(&mi_cmdline_hash);
mi_cmdline_hash_inited= false;
}
static mi_cmdline_entry *
mi_cmdline_entry_get(LEX_STRING *connection_name, bool create_if_missing)
{
LEX_STRING cmp_connection_name;
mi_cmdline_entry *entry;
if (!mi_cmdline_hash_inited &&
(!create_if_missing || mi_cmdline_init()))
return NULL;
/* Create a lowercase key for hash lookup. */
cmp_connection_name.length= connection_name->length;
if (!(cmp_connection_name.str= (char *)my_malloc(connection_name->length+1,
MYF(MY_WME))))
{
if (create_if_missing)
my_error(ER_OUTOFMEMORY, MYF(0), connection_name->length+1);
return NULL;
}
memcpy(cmp_connection_name.str, connection_name->str,
connection_name->length + 1);
my_casedn_str(system_charset_info, cmp_connection_name.str);
if ((entry= (mi_cmdline_entry *)
my_hash_search(&mi_cmdline_hash, (uchar *)cmp_connection_name.str,
cmp_connection_name.length)) ||
!create_if_missing)
{
my_free(cmp_connection_name.str);
return entry;
}
if (!(entry= (mi_cmdline_entry *)my_malloc(sizeof(*entry), MYF(MY_WME))))
{
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*entry));
my_free(cmp_connection_name.str);
return NULL;
}
entry->cmp_connection_name= cmp_connection_name;
entry->parallel_mode= opt_slave_parallel_mode;
if (my_hash_insert(&mi_cmdline_hash, (uchar *)entry))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
my_free(entry);
my_free(cmp_connection_name.str);
return NULL;
}
return entry;
}
/*
Look up a command line value for slave_parallel_mode. The value is returned
in *out_mode. If no command line value was given for this particular
connection name, the default value in opt_slave_parallel_mode is used.
*/
void
mi_slave_parallel_mode_lookup(LEX_STRING *connection_name, ulonglong *out_mode)
{
mi_cmdline_entry *entry;
if (!mi_cmdline_hash_inited ||
!(entry= mi_cmdline_entry_get(connection_name, false)))
*out_mode= opt_slave_parallel_mode;
else
*out_mode= entry->parallel_mode;
}
/*
Get a pointer to the location holding the value of the slave_parallel_mode
command line option for the given connection name. The pointer is returned
in *out_mode_ptr
If create_if_missing is true, then a new entry will be created if one did
not already exists. If false, then NULL will be returned in *out_mode_ptr if
an entry does not exist.
Returns 1 on error, 0 if ok.
*/
int
mi_slave_parallel_mode_ptr(LEX_STRING *connection_name,
ulonglong **out_mode_ptr, bool create_if_missing)
{
mi_cmdline_entry *entry;
*out_mode_ptr= NULL;
if (!create_if_missing && !mi_cmdline_hash_inited)
return 0;
entry= mi_cmdline_entry_get(connection_name, create_if_missing);
if (!entry)
{
if (create_if_missing)
return 1;
else
return 0;
}
*out_mode_ptr= &entry->parallel_mode;
return 0;
}
#endif /* HAVE_REPLICATION */

View File

@@ -16,6 +16,18 @@
#ifndef RPL_MI_H
#define RPL_MI_H
/*
Bit masks for the values in --slave-parallel-mode.
Note that these values cannot be changed - they are stored in master.info,
so need to be possible to read back in a different version of the server.
*/
#define SLAVE_PARALLEL_DOMAIN (1ULL << 0)
#define SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT (1ULL << 1)
#define SLAVE_PARALLEL_TRX (1ULL << 2)
#define SLAVE_PARALLEL_WAITING (1ULL << 3)
#ifdef HAVE_REPLICATION
#include "rpl_rli.h"
@@ -131,6 +143,8 @@ public:
};
extern TYPELIB slave_parallel_mode_typelib;
/*****************************************************************************
Replication IO Thread
@@ -180,6 +194,10 @@ class Master_info : public Slave_reporting_capability
return connection_name.str == 0;
}
static const char *using_gtid_astext(enum enum_using_gtid arg);
bool using_parallel()
{
return opt_slave_parallel_threads > 0 && parallel_mode != 0;
}
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN+6]; /* Room for multi-*/
@@ -293,6 +311,13 @@ class Master_info : public Slave_reporting_capability
/* domain-id based filter */
Domain_id_filter domain_id_filter;
/*
The parallel replication modes, if any. A combination (binary OR) of any
of SLAVE_PARALLEL_DOMAIN, SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT,
SLAVE_PARALLEL_TRX, and SLAVE_PARALLEL_WAITING.
*/
ulonglong parallel_mode;
};
int init_master_info(Master_info* mi, const char* master_info_fname,
@@ -358,6 +383,13 @@ void create_logfile_name_with_suffix(char *res_file_name, size_t length,
uchar *get_key_master_info(Master_info *mi, size_t *length,
my_bool not_used __attribute__((unused)));
void free_key_master_info(Master_info *mi);
int mi_cmdline_init();
void mi_cmdline_destroy();
void mi_slave_parallel_mode_lookup(LEX_STRING *connection_name,
ulonglong *out_mode);
int mi_slave_parallel_mode_ptr(LEX_STRING *connection_name,
ulonglong **out_mode_ptr,
bool create_if_missing);
#endif /* HAVE_REPLICATION */

View File

@@ -250,7 +250,13 @@ dbug_simulate_tmp_error(rpl_group_info *rgi, THD *thd)
asynchroneously to allow the former to complete its commit.
In this case, we convert the 'killed' error into a deadlock error, and retry
the later transaction. */
the later transaction.
If we are doing optimistic parallel apply of transactions not known to be
safe, we convert any error to a deadlock error, but then at retry we will
wait for prior transactions to commit first, so that the retries can be
done non-speculative.
*/
static void
convert_kill_to_deadlock_error(rpl_group_info *rgi)
{
@@ -260,8 +266,10 @@ convert_kill_to_deadlock_error(rpl_group_info *rgi)
if (!thd->get_stmt_da()->is_error())
return;
err_code= thd->get_stmt_da()->sql_errno();
if ((err_code == ER_QUERY_INTERRUPTED || err_code == ER_CONNECTION_KILLED) &&
rgi->killed_for_retry)
if ((rgi->speculation == rpl_group_info::SPECULATE_OPTIMISTIC &&
err_code != ER_PRIOR_COMMIT_FAILED) ||
((err_code == ER_QUERY_INTERRUPTED || err_code == ER_CONNECTION_KILLED) &&
rgi->killed_for_retry))
{
thd->clear_error();
my_error(ER_LOCK_DEADLOCK, MYF(0));
@@ -354,9 +362,43 @@ do_retry:
statistic_increment(slave_retried_transactions, LOCK_status);
mysql_mutex_unlock(&rli->data_lock);
mysql_mutex_lock(&entry->LOCK_parallel_entry);
register_wait_for_prior_event_group_commit(rgi, entry);
mysql_mutex_unlock(&entry->LOCK_parallel_entry);
for (;;)
{
mysql_mutex_lock(&entry->LOCK_parallel_entry);
register_wait_for_prior_event_group_commit(rgi, entry);
mysql_mutex_unlock(&entry->LOCK_parallel_entry);
if (rgi->speculation != rpl_group_info::SPECULATE_OPTIMISTIC)
break;
/*
We speculatively tried to run this in parallel with prior event groups,
but it did not work for some reason.
So let us wait for all prior transactions to complete before trying
again. This way, we avoid repeatedly retrying and failing a small
transaction that conflicts with a prior long-running one.
*/
if (!(err= thd->wait_for_prior_commit()))
{
rgi->speculation = rpl_group_info::SPECULATE_WAIT;
break;
}
convert_kill_to_deadlock_error(rgi);
if (!has_temporary_error(thd))
goto err;
/*
If we get a temporary error such as a deadlock kill, we can safely
ignore it, as we already rolled back.
But we still want to retry the wait for the prior transaction to
complete its commit.
*/
thd->clear_error();
if(thd->wait_for_commit_ptr)
thd->wait_for_commit_ptr->unregister_wait_for_prior_commit();
}
strmake_buf(log_name, ir->name);
if ((fd= open_binlog(&rlog, log_name, &errmsg)) <0)
@@ -550,6 +592,13 @@ handle_rpl_parallel_thread(void *arg)
thd->set_time();
thd->variables.lock_wait_timeout= LONG_TIMEOUT;
thd->system_thread_info.rpl_sql_info= &sql_info;
/*
We need to use (at least) REPEATABLE READ isolation level. Otherwise
speculative parallel apply can run out-of-order and give wrong results
for statement-based replication.
*/
thd->variables.tx_isolation= ISO_REPEATABLE_READ;
mysql_mutex_lock(&rpt->LOCK_rpl_thread);
rpt->thd= thd;
@@ -639,6 +688,7 @@ handle_rpl_parallel_thread(void *arg)
}
});
thd->tx_isolation= (enum_tx_isolation)thd->variables.tx_isolation;
in_event_group= true;
/*
If the standalone flag is set, then this event group consists of a
@@ -662,11 +712,11 @@ handle_rpl_parallel_thread(void *arg)
in parallel with.
*/
mysql_mutex_lock(&entry->LOCK_parallel_entry);
if (!gco->installed)
if (!(gco->flags & group_commit_orderer::INSTALLED))
{
if (gco->prev_gco)
gco->prev_gco->next_gco= gco;
gco->installed= true;
gco->flags|= group_commit_orderer::INSTALLED;
}
wait_count= gco->wait_count;
if (wait_count > entry->count_committing_event_groups)
@@ -766,6 +816,18 @@ handle_rpl_parallel_thread(void *arg)
/* We have to apply the event. */
}
}
/*
If we are optimistically running transactions in parallel, but this
particular event group should not run in parallel with what came
before, then wait now for the prior transaction to complete its
commit.
*/
if (rgi->speculation == rpl_group_info::SPECULATE_WAIT &&
(err= thd->wait_for_prior_commit()))
{
slave_output_error_info(rgi, thd);
signal_error_to_sql_driver_thread(thd, rgi, 1);
}
}
group_ending= is_group_ending(qev->ev, event_type);
@@ -1319,7 +1381,7 @@ rpl_parallel_thread::get_gco(uint64 wait_count, group_commit_orderer *prev)
gco->wait_count= wait_count;
gco->prev_gco= prev;
gco->next_gco= NULL;
gco->installed= false;
gco->flags= 0;
return gco;
}
@@ -1849,6 +1911,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
bool did_enter_cond= false;
PSI_stage_info old_stage;
DBUG_EXECUTE_IF("slave_crash_if_parallel_apply", DBUG_SUICIDE(););
/* Handle master log name change, seen in Rotate_log_event. */
typ= ev->get_type_code();
if (unlikely(typ == ROTATE_EVENT))
@@ -1929,7 +1992,8 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
if (typ == GTID_EVENT)
{
Gtid_log_event *gtid_ev= static_cast<Gtid_log_event *>(ev);
uint32 domain_id= (rli->mi->using_gtid == Master_info::USE_GTID_NO ?
uint32 domain_id= (rli->mi->using_gtid == Master_info::USE_GTID_NO ||
!(rli->mi->parallel_mode & SLAVE_PARALLEL_DOMAIN) ?
0 : gtid_ev->domain_id);
if (!(e= find(domain_id)))
{
@@ -1969,6 +2033,12 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
if (typ == GTID_EVENT)
{
Gtid_log_event *gtid_ev= static_cast<Gtid_log_event *>(ev);
bool new_gco;
ulonglong mode= rli->mi->parallel_mode;
uchar gtid_flags= gtid_ev->flags2;
group_commit_orderer *gco;
uint8 force_switch_flag;
enum rpl_group_info::enum_speculation speculation;
if (!(rgi= cur_thread->get_rgi(rli, gtid_ev, e, event_size)))
{
@@ -1995,19 +2065,87 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
rgi->wait_commit_sub_id= e->current_sub_id;
rgi->wait_commit_group_info= e->current_group_info;
if (!((gtid_ev->flags2 & Gtid_log_event::FL_GROUP_COMMIT_ID) &&
e->last_commit_id == gtid_ev->commit_id))
speculation= rpl_group_info::SPECULATE_NO;
new_gco= true;
force_switch_flag= 0;
gco= e->current_gco;
if (likely(gco))
{
uint8 flags= gco->flags;
if (!(gtid_flags & Gtid_log_event::FL_GROUP_COMMIT_ID) ||
e->last_commit_id != gtid_ev->commit_id)
flags|= group_commit_orderer::MULTI_BATCH;
/* Make sure we do not attempt to run DDL in parallel speculatively. */
if (gtid_flags & Gtid_log_event::FL_DDL)
flags|= (force_switch_flag= group_commit_orderer::FORCE_SWITCH);
if (!(flags & group_commit_orderer::MULTI_BATCH))
{
/*
Still the same batch of event groups that group-committed together
on the master, so we can run in parallel.
*/
new_gco= false;
}
else if ((mode & SLAVE_PARALLEL_TRX) &&
!(flags & group_commit_orderer::FORCE_SWITCH))
{
/*
In transactional parallel mode, we optimistically attempt to run
non-DDL in parallel. In case of conflicts, we catch the conflict as
a deadlock or other error, roll back and retry serially.
The assumption is that only a few event groups will be
non-transactional or otherwise unsuitable for parallel apply. Those
transactions are still scheduled in parallel, but we set a flag that
will make the worker thread wait for everything before to complete
before starting.
*/
new_gco= false;
if (!(gtid_flags & Gtid_log_event::FL_TRANSACTIONAL) ||
!(gtid_flags & Gtid_log_event::FL_ALLOW_PARALLEL) ||
((gtid_flags & Gtid_log_event::FL_WAITED) &&
!(mode & SLAVE_PARALLEL_WAITING)))
{
/*
This transaction should not be speculatively run in parallel with
what came before, either because it cannot safely be rolled back in
case of a conflict, or because it was marked as likely to conflict
and require expensive rollback and retry.
Here we mark it as such, and then the worker thread will do a
wait_for_prior_commit() before starting it. We do not introduce a
new group_commit_orderer, since we still want following transactions
to run in parallel with transactions prior to this one.
*/
speculation= rpl_group_info::SPECULATE_WAIT;
}
else
speculation= rpl_group_info::SPECULATE_OPTIMISTIC;
}
gco->flags= flags;
}
rgi->speculation= speculation;
if (gtid_flags & Gtid_log_event::FL_GROUP_COMMIT_ID)
e->last_commit_id= gtid_ev->commit_id;
else
e->last_commit_id= 0;
if (new_gco)
{
/*
A new batch of transactions that group-committed together on the master.
Do not run this event group in parallel with what came before; instead
wait for everything prior to at least have started its commit phase, to
avoid any risk of performing any conflicting action too early.
Remember the count that marks the end of the previous group committed
batch, and allocate a new gco.
Remember the count that marks the end of the previous batch of event
groups that run in parallel, and allocate a new gco.
*/
uint64 count= e->count_queued_event_groups;
group_commit_orderer *gco;
if (!(gco= cur_thread->get_gco(count, e->current_gco)))
if (!(gco= cur_thread->get_gco(count, gco)))
{
cur_thread->free_rgi(rgi);
cur_thread->free_qev(qev);
@@ -2016,14 +2154,11 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
delete ev;
return 1;
}
e->current_gco= rgi->gco= gco;
gco->flags|= force_switch_flag;
e->current_gco= gco;
}
else
rgi->gco= e->current_gco;
if (gtid_ev->flags2 & Gtid_log_event::FL_GROUP_COMMIT_ID)
e->last_commit_id= gtid_ev->commit_id;
else
e->last_commit_id= 0;
rgi->gco= gco;
qev->rgi= e->current_group_info= rgi;
e->current_sub_id= rgi->gtid_sub_id;
++e->count_queued_event_groups;

View File

@@ -49,7 +49,29 @@ struct group_commit_orderer {
uint64 wait_count;
group_commit_orderer *prev_gco;
group_commit_orderer *next_gco;
bool installed;
/*
This flag is set when this GCO has been installed into the next_gco pointer
of the previous GCO.
*/
static const uint8 INSTALLED = 0x01;
/*
This flag is set for a GCO in which we have event groups with multiple
different commit_id values from the master. This happens when we
optimistically try to execute in parallel transactions not known to be
conflict-free.
When this flag is set, in case of DDL we need to start a new GCO regardless
of current commit_id, as DDL is not safe to speculatively apply in parallel
with prior event groups.
*/
static const uint8 MULTI_BATCH = 0x02;
/*
This flag is set for a GCO that contains DDL. If set, it forces a switch to
a new GCO upon seeing a new commit_id, as DDL is not safe to speculatively
replicate in parallel with subsequent transactions.
*/
static const uint8 FORCE_SWITCH = 0x04;
uint8 flags;
};

View File

@@ -1600,7 +1600,9 @@ rpl_group_info::reinit(Relay_log_info *rli)
row_stmt_start_timestamp= 0;
long_find_row_note_printed= false;
did_mark_start_commit= false;
gtid_ev_flags2= 0;
gtid_ignore_duplicate_state= GTID_DUPLICATE_NULL;
speculation= SPECULATE_NO;
commit_orderer.reinit();
}

View File

@@ -621,6 +621,8 @@ struct rpl_group_info
counting one event group twice.
*/
bool did_mark_start_commit;
/* Copy of flags2 from GTID event. */
uchar gtid_ev_flags2;
enum {
GTID_DUPLICATE_NULL=0,
GTID_DUPLICATE_IGNORE=1,
@@ -652,6 +654,36 @@ struct rpl_group_info
inuse_relaylog *relay_log;
uint64 retry_start_offset;
uint64 retry_event_count;
/*
If `speculation' is != SPECULATE_NO, then we are optimistically running
this transaction in parallel, even though it might not be safe (there may
be a conflict with a prior event group).
In this case, a conflict can cause other errors than deadlocks (like
duplicate key for example). So in case of _any_ error, we need to roll
back and retry the event group.
*/
enum enum_speculation {
/*
This transaction was group-committed together on the master with the
other transactions with which it is replicated in parallel.
*/
SPECULATE_NO,
/*
We will optimistically try to run this transaction in parallel with
other transactions, even though it is not known to be conflict free.
If we get a conflict, we will detect it as a deadlock, roll back and
retry.
*/
SPECULATE_OPTIMISTIC,
/*
This transaction got a conflict during speculative parallel apply, or
it was marked on the master as likely to cause a conflict or unsafe to
speculate. So it will wait for the prior transaction to commit before
starting to replicate.
*/
SPECULATE_WAIT
} speculation;
bool killed_for_retry;
rpl_group_info(Relay_log_info *rli_);

View File

@@ -7115,3 +7115,5 @@ ER_SUBQUERIES_NOT_SUPPORTED 42000
eng "%s does not support subqueries or stored functions."
ER_SET_STATEMENT_NOT_SUPPORTED 42000
eng "The system variable %.200s cannot be set in SET STATEMENT."
ER_INVALID_SLAVE_PARALLEL_MODE
eng "Invalid use of '%s' option for slave_parallel_mode"

View File

@@ -626,8 +626,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
if (thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL))
{
DBUG_PRINT("info",("Terminating SQL thread"));
if (opt_slave_parallel_threads > 0 &&
mi->rli.abort_slave && mi->rli.stop_for_until)
if (mi->using_parallel() && mi->rli.abort_slave && mi->rli.stop_for_until)
{
mi->rli.stop_for_until= false;
mi->rli.parallel.stop_during_until();
@@ -2585,6 +2584,8 @@ static bool send_show_master_info_header(THD *thd, bool full,
FN_REFLEN));
field_list.push_back(new Item_empty_string("Replicate_Ignore_Domain_Ids",
FN_REFLEN));
field_list.push_back(new Item_empty_string("Parallel_Mode",
sizeof("domain,follow_master_commit,transactional,waiting")-1));
if (full)
{
field_list.push_back(new Item_return_int("Retried_transactions",
@@ -2717,8 +2718,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
else
{
idle= mi->rli.sql_thread_caught_up;
if (opt_slave_parallel_threads > 0 && idle &&
!mi->rli.parallel.workers_idle())
if (mi->using_parallel() && idle && !mi->rli.parallel.workers_idle())
idle= false;
}
if (idle)
@@ -2773,7 +2773,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
protocol->store(mi->ssl_ca, &my_charset_bin);
// Master_Ssl_Crlpath
protocol->store(mi->ssl_capath, &my_charset_bin);
// Using_Gtid
protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin);
// Gtid_IO_Pos
{
char buff[30];
String tmp(buff, sizeof(buff), system_charset_info);
@@ -2784,6 +2786,26 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
// Replicate_Do_Domain_Ids & Replicate_Ignore_Domain_Ids
mi->domain_id_filter.store_ids(thd);
// Parallel_Mode
{
/* Note how sizeof("domain") has room for "domain," due to traling 0. */
char buf[sizeof("domain") + sizeof("follow_master_commit") +
sizeof("transactional") + sizeof("waiting") + 1];
char *p= buf;
uint32 mode= mi->parallel_mode;
if (mode & SLAVE_PARALLEL_DOMAIN)
p= strmov(p, "domain,");
if (mode & SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT)
p= strmov(p, "follow_master_commit,");
if (mode & SLAVE_PARALLEL_TRX)
p= strmov(p, "transactional,");
if (mode & SLAVE_PARALLEL_WAITING)
p= strmov(p, "waiting,");
if (p != buf)
--p; // Discard last ','
protocol->store(buf, p-buf, &my_charset_bin);
}
if (full)
{
protocol->store((uint32) mi->rli.retried_trans);
@@ -3492,7 +3514,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
update_state_of_relay_log(rli, ev);
if (opt_slave_parallel_threads > 0)
if (rli->mi->using_parallel())
{
int res= rli->parallel.do_event(serial_rgi, ev, event_size);
if (res >= 0)
@@ -4651,7 +4673,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
}
}
if (opt_slave_parallel_threads > 0)
if (mi->using_parallel())
rli->parallel.wait_for_done(thd, rli);
/* Thread stopped. Print the current replication position to the log */
@@ -4677,7 +4699,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
(We want the first one to be before the printout of stop position to
get the correct position printed.)
*/
if (opt_slave_parallel_threads > 0)
if (mi->using_parallel())
rli->parallel.wait_for_done(thd, rli);
/*
@@ -6382,7 +6404,7 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
llstr(my_b_tell(cur_log),llbuf1),
llstr(rli->event_relay_log_pos,llbuf2)));
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(opt_slave_parallel_threads > 0 ||
DBUG_ASSERT(rli->mi->using_parallel() ||
my_b_tell(cur_log) == rli->event_relay_log_pos);
}
#endif

View File

@@ -1421,6 +1421,9 @@ void THD::init(void)
transaction.all.modified_non_trans_table=
transaction.stmt.modified_non_trans_table= FALSE;
transaction.all.m_unsafe_rollback_flags=
transaction.stmt.m_unsafe_rollback_flags= 0;
open_options=ha_open_options;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
@@ -4372,6 +4375,8 @@ thd_need_wait_for(const MYSQL_THD thd)
{
rpl_group_info *rgi;
if (mysql_bin_log.is_open())
return true;
if (!thd)
return false;
rgi= thd->rgi_slave;
@@ -4406,12 +4411,16 @@ thd_need_wait_for(const MYSQL_THD thd)
not harmful, but could lead to unnecessary kill and retry, so best avoided).
*/
extern "C" void
thd_report_wait_for(const MYSQL_THD thd, MYSQL_THD other_thd)
thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd)
{
rpl_group_info *rgi;
rpl_group_info *other_rgi;
if (!thd || !other_thd)
if (!thd)
return;
DEBUG_SYNC(thd, "thd_report_wait_for");
thd->transaction.stmt.mark_trans_did_wait();
if (!other_thd)
return;
rgi= thd->rgi_slave;
other_rgi= other_thd->rgi_slave;

View File

@@ -1089,6 +1089,8 @@ void multi_delete::abort_result_set()
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
/*
If rows from the first table only has been deleted and it is
@@ -1280,6 +1282,8 @@ bool multi_delete::send_eof()
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
/*
We must invalidate the query cache before binlog writing and

View File

@@ -1011,6 +1011,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
if (error <= 0 ||
thd->transaction.stmt.modified_non_trans_table ||
@@ -3690,6 +3692,8 @@ bool select_insert::send_eof()
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
DBUG_ASSERT(trans_table || !changed ||
thd->transaction.stmt.modified_non_trans_table);

View File

@@ -608,6 +608,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
{

View File

@@ -6646,6 +6646,7 @@ void THD::reset_for_next_command()
{
thd->variables.option_bits&= ~OPTION_KEEP_LOG;
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
}
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
thd->thread_specific_used= FALSE;

View File

@@ -181,6 +181,7 @@
*/
#define OPTION_ALLOW_BATCH (1ULL << 36) // THD, intern (slave)
#define OPTION_SKIP_REPLICATION (1ULL << 37) // THD, user
#define OPTION_RPL_ALLOW_PARALLEL (1ULL << 38)
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT

View File

@@ -969,6 +969,8 @@ int mysql_update(THD *thd,
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
/*
error < 0 means really no error at all: we processed all rows until the
@@ -2247,6 +2249,8 @@ void multi_update::abort_result_set()
}
thd->transaction.all.modified_non_trans_table= TRUE;
}
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
DBUG_ASSERT(trans_safe || !updated || thd->transaction.stmt.modified_non_trans_table);
}
@@ -2498,6 +2502,8 @@ bool multi_update::send_eof()
if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE;
thd->transaction.all.m_unsafe_rollback_flags|=
(thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table)
{

View File

@@ -1871,6 +1871,128 @@ static Sys_var_ulong Sys_slave_parallel_max_queued(
VALID_RANGE(0,2147483647), DEFAULT(131072), BLOCK_SIZE(1));
bool
Sys_var_slave_parallel_mode::global_update(THD *thd, set_var *var)
{
ulonglong new_value= var->save_result.ulonglong_value;
LEX_STRING *base_name= &var->base;
Master_info *mi;
ulonglong *value_ptr;
bool res= false;
if ((new_value & (SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT|SLAVE_PARALLEL_TRX)) ==
(SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT|SLAVE_PARALLEL_TRX))
{
my_error(ER_INVALID_SLAVE_PARALLEL_MODE, MYF(0), "transactional");
return true;
}
if (!base_name->length)
base_name= &thd->variables.default_master_connection;
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->
get_master_info(base_name, Sql_condition::WARN_LEVEL_WARN);
if (mi)
{
if (mi->rli.slave_running)
{
my_error(ER_SLAVE_MUST_STOP, MYF(0),
mi->connection_name.length, mi->connection_name.str);
res= true;
}
else
{
mi->parallel_mode= new_value;
if (!base_name->length)
opt_slave_parallel_mode= new_value;
}
}
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
if (!mi)
{
my_error(WARN_NO_MASTER_INFO, MYF(0), base_name->length, base_name->str);
return true;
}
mi_slave_parallel_mode_ptr(base_name, &value_ptr, false);
if (value_ptr)
*value_ptr= new_value;
return res;
}
uchar *
Sys_var_slave_parallel_mode::global_value_ptr(THD *thd, const LEX_STRING *base_name)
{
Master_info *mi;
ulonglong val= opt_slave_parallel_mode;
if (!base_name->length)
base_name= &thd->variables.default_master_connection;
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->
get_master_info(base_name, Sql_condition::WARN_LEVEL_WARN);
if (mi)
val= mi->parallel_mode;
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_global_system_variables);
if (!mi && base_name->length)
{
my_error(WARN_NO_MASTER_INFO, MYF(0), base_name->length, base_name->str);
return NULL;
}
return (uchar*)set_to_string(thd, 0, val, typelib.type_names);
}
static const char *slave_parallel_mode_names[] = {
"domain", "follow_master_commit", "transactional", "waiting", NULL
};
TYPELIB slave_parallel_mode_typelib = {
array_elements(slave_parallel_mode_names)-1,
"",
slave_parallel_mode_names,
NULL
};
static Sys_var_slave_parallel_mode Sys_slave_parallel_mode(
"slave_parallel_mode",
"Controls what transactions are applied in parallel when using "
"--slave-parallel-threads. Syntax: slave_parallel_mode=value[,value...], "
"where \"value\" could be one or more of: \"domain\", to apply different "
"replication domains in parallel; \"follow_master_commit\", to apply "
"in parallel transactions that group-committed together on the master; "
"\"transactional\", to optimistically try to apply all transactional "
"DML in parallel; and \"waiting\" to extend \"transactional\" to "
"even transactions that had to wait on the master.",
GLOBAL_VAR(opt_slave_parallel_mode),
NO_CMD_LINE, slave_parallel_mode_names,
DEFAULT(SLAVE_PARALLEL_DOMAIN |
SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT));
static Sys_var_bit Sys_replicate_allow_parallel(
"replicate_allow_parallel",
"If set when a transaction is written to the binlog, that transaction "
"is allowed to replicate in parallel on a slave where "
"slave_parallel_mode is set to \"transactional\". Can be cleared for "
"transactions that are likely to cause a conflict if replicated in "
"parallel, to avoid unnecessary rollback and retry.",
SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_RPL_ALLOW_PARALLEL,
DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG);
static bool
check_gtid_ignore_duplicates(sys_var *self, THD *thd, set_var *var)
{
@@ -2952,12 +3074,6 @@ static const char *old_mode_names[]=
0
};
export bool old_mode_string_representation(THD *thd, ulonglong sql_mode,
LEX_STRING *ls)
{
set_to_string(thd, ls, sql_mode, old_mode_names);
return ls->str == 0;
}
/*
sql_mode should *not* be IN_BINLOG as the slave can't remember this
anyway on restart.
@@ -3387,6 +3503,7 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
~(OPTION_BEGIN | OPTION_KEEP_LOG | OPTION_NOT_AUTOCOMMIT |
OPTION_GTID_BEGIN);
thd->transaction.all.modified_non_trans_table= false;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
return false;
}
@@ -3396,6 +3513,7 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
{
// disabling autocommit
thd->transaction.all.modified_non_trans_table= false;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
thd->variables.option_bits|= OPTION_NOT_AUTOCOMMIT;
return false;

View File

@@ -2275,3 +2275,24 @@ public:
return NULL;
}
};
/**
Class for connection_name.slave_parallel_mode.
*/
class Sys_var_slave_parallel_mode: public Sys_var_set
{
public:
Sys_var_slave_parallel_mode(const char *name_arg,
const char *comment, int flag_args, ptrdiff_t off, size_t size,
CMD_LINE getopt, const char *values[], ulonglong def_val)
: Sys_var_set(name_arg, comment, flag_args, off, size,
getopt, values, def_val)
{
option.var_type|= GET_ASK_ADDR;
option.value= (uchar**)1; // crash me, please
SYSVAR_ASSERT(scope() == GLOBAL);
}
bool global_update(THD *thd, set_var *var);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
};

View File

@@ -155,6 +155,7 @@ bool trans_begin(THD *thd, uint flags)
when we come here. We should at some point change this to an assert.
*/
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
if (res)
DBUG_RETURN(TRUE);
@@ -243,6 +244,7 @@ bool trans_commit(THD *thd)
(void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->lex->start_transaction_opt= 0;
DBUG_RETURN(MY_TEST(res));
@@ -290,6 +292,7 @@ bool trans_commit_implicit(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
/*
Upon implicit commit, reset the current transaction
@@ -335,6 +338,7 @@ bool trans_rollback(THD *thd)
/* Reset the binlog transaction marker */
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->lex->start_transaction_opt= 0;
DBUG_RETURN(MY_TEST(res));
@@ -379,6 +383,7 @@ bool trans_rollback_implicit(THD *thd)
*/
thd->variables.option_bits&= ~(OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= false;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
/* Rollback should clear transaction_rollback_request flag. */
DBUG_ASSERT(! thd->transaction_rollback_request);
@@ -891,6 +896,7 @@ bool trans_xa_commit(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
@@ -940,6 +946,7 @@ bool trans_xa_rollback(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));

View File

@@ -376,7 +376,7 @@ struct lock_stack_t {
ulint heap_no; /*!< heap number if rec lock */
};
extern "C" void thd_report_wait_for(const MYSQL_THD thd, MYSQL_THD other_thd);
extern "C" void thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd);
extern "C" int thd_need_wait_for(const MYSQL_THD thd);
extern "C"
int thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd);

View File

@@ -1325,24 +1325,6 @@ innobase_start_trx_and_assign_read_view(
THD* thd); /* in: MySQL thread handle of the
user for whom the transaction should
be committed */
#ifdef NOT_USED
/*****************************************************************//**
Creates an InnoDB transaction struct for the thd if it does not yet have one.
Starts a new InnoDB transaction if a transaction is not yet started. And
clones snapshot for a consistent read from another session, if it has one.
@return 0 */
static
int
innobase_start_trx_and_clone_read_view(
/*====================================*/
handlerton* hton, /* in: Innodb handlerton */
THD* thd, /* in: MySQL thread handle of the
user for whom the transaction should
be committed */
THD* from_thd); /* in: MySQL thread handle of the
user session from which the consistent
read should be cloned */
#endif
/****************************************************************//**
Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes
the logs, and the name of this function should be innobase_checkpoint.
@@ -4393,104 +4375,6 @@ innobase_commit_ordered(
DBUG_VOID_RETURN;
}
#ifdef NOT_USED
/*****************************************************************//**
Creates an InnoDB transaction struct for the thd if it does not yet have one.
Starts a new InnoDB transaction if a transaction is not yet started. And
clones snapshot for a consistent read from another session, if it has one.
@return 0 */
static
int
innobase_start_trx_and_clone_read_view(
/*====================================*/
handlerton* hton, /* in: Innodb handlerton */
THD* thd, /* in: MySQL thread handle of the
user for whom the transaction should
be committed */
THD* from_thd) /* in: MySQL thread handle of the
user session from which the consistent
read should be cloned */
{
trx_t* trx;
trx_t* from_trx;
DBUG_ENTER("innobase_start_trx_and_clone_read_view");
DBUG_ASSERT(hton == innodb_hton_ptr);
/* Get transaction handle from the donor session */
from_trx = thd_to_trx(from_thd);
if (!from_trx) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: WITH CONSISTENT SNAPSHOT "
"FROM SESSION was ignored because the "
"specified session does not have an open "
"transaction inside InnoDB.");
DBUG_RETURN(0);
}
/* Create a new trx struct for thd, if it does not yet have one */
trx = check_trx_exists(thd);
/* This is just to play safe: release a possible FIFO ticket and
search latch. Since we can potentially reserve the trx_sys->mutex,
we have to release the search system latch first to obey the latching
order. */
trx_search_latch_release_if_reserved(trx);
innobase_srv_conc_force_exit_innodb(trx);
/* If the transaction is not started yet, start it */
trx_start_if_not_started_xa(trx);
/* Clone the read view from the donor transaction. Do this only if
transaction is using REPEATABLE READ isolation level. */
trx->isolation_level = innobase_map_isolation_level(
thd_get_trx_isolation(thd));
if (trx->isolation_level != TRX_ISO_REPEATABLE_READ) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: WITH CONSISTENT SNAPSHOT "
"was ignored because this phrase "
"can only be used with "
"REPEATABLE READ isolation level.");
} else {
lock_mutex_enter();
mutex_enter(&trx_sys->mutex);
trx_mutex_enter(from_trx);
if (!trx_clone_read_view(trx, from_trx)) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: WITH CONSISTENT SNAPSHOT "
"FROM SESSION was ignored because "
"the target transaction has not been "
"assigned a read view.");
}
trx_mutex_exit(from_trx);
mutex_exit(&trx_sys->mutex);
lock_mutex_exit();
}
/* Set the MySQL flag to mark that there is an active transaction */
innobase_register_trx(hton, current_thd, trx);
DBUG_RETURN(0);
}
#endif
/*****************************************************************//**
Commits a transaction in an InnoDB database or marks an SQL statement
ended.

View File

@@ -376,7 +376,7 @@ struct lock_stack_t {
ulint heap_no; /*!< heap number if rec lock */
};
extern "C" void thd_report_wait_for(const MYSQL_THD thd, MYSQL_THD other_thd);
extern "C" void thd_report_wait_for(MYSQL_THD thd, MYSQL_THD other_thd);
extern "C" int thd_need_wait_for(const MYSQL_THD thd);
extern "C"
int thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd);