1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-26: Global transaction ID. First alpha release.

Merge of 10.0-mdev26 feature tree into 10.0-base.

Global transaction ID is prepended to each event group in the binlog.

Slave connect can request to start from GTID position instead of specifying
file name/offset of master binlog. This facilitates easy switch to a new
master.

Slave GTID state is stored in a table mysql.rpl_slave_state, which can be
InnoDB to get crash-safe slave state.

GTID includes a replication domain ID, allowing to keep track of distinct
positions for each of multiple masters.
This commit is contained in:
unknown
2013-04-15 10:55:27 +02:00
251 changed files with 17002 additions and 8586 deletions

View File

@ -3,11 +3,11 @@ RESET MASTER;
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 421
master-bin.000001 484
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
Binlog_snapshot_position 421
Binlog_snapshot_position 484
BEGIN;
INSERT INTO t1 VALUES (0, "");
# Connection con1
@ -38,10 +38,10 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
Binlog_snapshot_position 945
Binlog_snapshot_position 986
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 1357
master-bin.000001 1338
SELECT * FROM t2 ORDER BY a;
a
2
@ -60,45 +60,48 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
Binlog_snapshot_position 945
Binlog_snapshot_position 986
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 326
master-bin.000002 367
COMMIT;
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000002
Binlog_snapshot_position 326
Binlog_snapshot_position 367
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 326
master-bin.000002 367
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 246 Server ver: #, Binlog ver: #
master-bin.000001 246 Binlog_checkpoint 1 286 master-bin.000001
master-bin.000001 286 Query 1 421 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
master-bin.000001 421 Query 1 533 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
master-bin.000001 533 Query 1 601 BEGIN
master-bin.000001 601 Query 1 689 use `test`; INSERT INTO t2 VALUES (2)
master-bin.000001 689 Query 1 758 COMMIT
master-bin.000001 758 Query 1 826 BEGIN
master-bin.000001 826 Query 1 918 use `test`; INSERT INTO t1 VALUES (0, "")
master-bin.000001 918 Xid 1 945 COMMIT /* XID */
master-bin.000001 945 Query 1 1013 BEGIN
master-bin.000001 1013 Query 1 1101 use `test`; INSERT INTO t2 VALUES (3)
master-bin.000001 1101 Query 1 1170 COMMIT
master-bin.000001 1170 Query 1 1238 BEGIN
master-bin.000001 1238 Query 1 1330 use `test`; INSERT INTO t1 VALUES (4, "")
master-bin.000001 1330 Xid 1 1357 COMMIT /* XID */
master-bin.000001 1357 Query 1 1425 BEGIN
master-bin.000001 1425 Query 1 1517 use `test`; INSERT INTO t1 VALUES (1, "")
master-bin.000001 1517 Xid 1 1544 COMMIT /* XID */
master-bin.000001 1544 Query 1 1612 BEGIN
master-bin.000001 1612 Query 1 1709 use `test`; INSERT INTO t1 VALUES (2, "first")
master-bin.000001 1709 Query 1 1807 use `test`; INSERT INTO t1 VALUES (2, "second")
master-bin.000001 1807 Xid 1 1834 COMMIT /* XID */
master-bin.000001 1834 Query 1 1902 BEGIN
master-bin.000001 1902 Query 1 1994 use `test`; INSERT INTO t1 VALUES (3, "")
master-bin.000001 1994 Xid 1 2021 COMMIT /* XID */
master-bin.000001 2021 Rotate 1 2065 master-bin.000002;pos=4
master-bin.000001 4 Format_desc 1 248 Server ver: #, Binlog ver: #
master-bin.000001 248 Gtid_list 1 271 []
master-bin.000001 271 Binlog_checkpoint 1 311 master-bin.000001
master-bin.000001 311 Gtid 1 349 GTID 0-1-1
master-bin.000001 349 Query 1 484 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
master-bin.000001 484 Gtid 1 522 GTID 0-1-2
master-bin.000001 522 Query 1 634 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
master-bin.000001 634 Gtid 1 672 BEGIN GTID 0-1-3
master-bin.000001 672 Query 1 760 use `test`; INSERT INTO t2 VALUES (2)
master-bin.000001 760 Query 1 829 COMMIT
master-bin.000001 829 Gtid 1 867 BEGIN GTID 0-1-4
master-bin.000001 867 Query 1 959 use `test`; INSERT INTO t1 VALUES (0, "")
master-bin.000001 959 Xid 1 986 COMMIT /* XID */
master-bin.000001 986 Gtid 1 1024 BEGIN GTID 0-1-5
master-bin.000001 1024 Query 1 1112 use `test`; INSERT INTO t2 VALUES (3)
master-bin.000001 1112 Query 1 1181 COMMIT
master-bin.000001 1181 Gtid 1 1219 BEGIN GTID 0-1-6
master-bin.000001 1219 Query 1 1311 use `test`; INSERT INTO t1 VALUES (4, "")
master-bin.000001 1311 Xid 1 1338 COMMIT /* XID */
master-bin.000001 1338 Gtid 1 1376 BEGIN GTID 0-1-7
master-bin.000001 1376 Query 1 1468 use `test`; INSERT INTO t1 VALUES (1, "")
master-bin.000001 1468 Xid 1 1495 COMMIT /* XID */
master-bin.000001 1495 Gtid 1 1533 BEGIN GTID 0-1-8
master-bin.000001 1533 Query 1 1630 use `test`; INSERT INTO t1 VALUES (2, "first")
master-bin.000001 1630 Query 1 1728 use `test`; INSERT INTO t1 VALUES (2, "second")
master-bin.000001 1728 Xid 1 1755 COMMIT /* XID */
master-bin.000001 1755 Gtid 1 1793 BEGIN GTID 0-1-9
master-bin.000001 1793 Query 1 1885 use `test`; INSERT INTO t1 VALUES (3, "")
master-bin.000001 1885 Xid 1 1912 COMMIT /* XID */
master-bin.000001 1912 Rotate 1 1956 master-bin.000002;pos=4
DROP TABLE t1,t2;

View File

@ -31,6 +31,6 @@ a
1
2
3
InnoDB: Last MySQL binlog file position 0 947, file name ./master-bin.000001
InnoDB: Last MySQL binlog file position 0 920, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;

View File

@ -32,6 +32,6 @@ a
1
2
3
InnoDB: Last MySQL binlog file position 0 947, file name ./master-bin.000001
InnoDB: Last MySQL binlog file position 0 920, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;

View File

@ -36,7 +36,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
SET binlog_format= mixed;
@ -58,7 +58,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@ -81,7 +81,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@ -104,7 +104,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@ -117,7 +117,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
DROP TABLE t1;

View File

@ -36,7 +36,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
SET binlog_format= mixed;
@ -58,7 +58,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@ -81,7 +81,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@ -104,7 +104,7 @@ a b c d 7
a b c d 8
a b c d 9
a b c d 10
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
delete from t1;
@ -117,7 +117,7 @@ COMMIT;
Got one of the listed errors
SELECT * FROM t1 ORDER BY id;
a b c d id
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
DROP TABLE t1;

View File

@ -66,7 +66,7 @@ while ($numtests)
# table and binlog should be in sync.
SELECT * FROM t1 ORDER BY id;
--replace_column 2 # 5 #
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
delete from t1;

View File

@ -66,7 +66,7 @@ while ($numtests)
# table and binlog should be in sync.
SELECT * FROM t1 ORDER BY id;
--replace_column 2 # 5 #
SHOW BINLOG EVENTS LIMIT 3,1;
SHOW BINLOG EVENTS LIMIT 4,1;
delete from t1;