Commit 416aed25 authored by unknown's avatar unknown

MDEV-4475: Replication from MariaDB 10.0 to 5.5 does not work

The problem was the Gtid_list event which is logged to the binlog in
10.0 and is not understood by the 5.5 server.

This event is supposed to be replaced with a dummy event for 5.5
servers. But the very first event logged in the very first binlog
has an empty list of GTID, which makes the event too short to be
replacable with an empty event.

The fix is to pad the empty Gtid_list event to be big enough to
be replacable by a dummy event.
parent 1cd6eb5f
......@@ -334,10 +334,10 @@ DROP TABLE t1;
DROP TABLE t2;
SHOW BINLOG EVENTS LIMIT 7,3;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 591 Xid 1 618 COMMIT /* XID */
master-bin.000001 618 Gtid 1 656 GTID 0-1-3
master-bin.000001 656 Query 1 775 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=937;
master-bin.000001 593 Xid 1 620 COMMIT /* XID */
master-bin.000001 620 Gtid 1 658 GTID 0-1-3
master-bin.000001 658 Query 1 777 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=939;
SELECT * FROM t1 ORDER BY a;
a
1
......
......@@ -16,17 +16,17 @@ test.t1 analyze status OK
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
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 449 use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB
master-bin.000001 449 Gtid 1 487 GTID 0-1-2
master-bin.000001 487 Query 1 566 use `test`; ANALYZE TABLE t1
master-bin.000001 566 Gtid 1 604 GTID 0-1-3
master-bin.000001 604 Query 1 708 use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 708 Gtid 1 746 GTID 0-1-4
master-bin.000001 746 Query 1 882 use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2
master-bin.000001 882 Gtid 1 920 GTID 0-1-5
master-bin.000001 920 Query 1 1018 use `test`; ALTER TABLE t1 ANALYZE PARTITION p1
master-bin.000001 248 Gtid_list 1 273 []
master-bin.000001 273 Binlog_checkpoint 1 313 master-bin.000001
master-bin.000001 313 Gtid 1 351 GTID 0-1-1
master-bin.000001 351 Query 1 451 use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB
master-bin.000001 451 Gtid 1 489 GTID 0-1-2
master-bin.000001 489 Query 1 568 use `test`; ANALYZE TABLE t1
master-bin.000001 568 Gtid 1 606 GTID 0-1-3
master-bin.000001 606 Query 1 710 use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 710 Gtid 1 748 GTID 0-1-4
master-bin.000001 748 Query 1 884 use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2
master-bin.000001 884 Gtid 1 922 GTID 0-1-5
master-bin.000001 922 Query 1 1020 use `test`; ALTER TABLE t1 ANALYZE PARTITION p1
SET use_stat_tables = DEFAULT;
DROP TABLE t1;
......@@ -959,10 +959,10 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # User var # # @`b`=_latin1 0x<binlog_start>5 COLLATE latin1_swedish_ci
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # User var # # @`b`=_latin1 0x<binlog_start>5 COLLATE latin1_swedish_ci
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
drop trigger trg_del_t2;
......
......@@ -54,18 +54,18 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
let $start_pos= `select @binlog_start_pos + 694`;
let $start_pos= `select @binlog_start_pos + 696`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
let $stop_pos= `select @binlog_start_pos + 694`;
let $stop_pos= `select @binlog_start_pos + 696`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
let $start_pos= `select @binlog_start_pos + 694`;
let $stop_pos= `select @binlog_start_pos + 855`;
let $start_pos= `select @binlog_start_pos + 696`;
let $stop_pos= `select @binlog_start_pos + 857`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
......@@ -92,12 +92,12 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
let $start_pos= `select @binlog_start_pos + 694`;
let $start_pos= `select @binlog_start_pos + 696`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
let $stop_pos= `select @binlog_start_pos + 132`;
let $stop_pos= `select @binlog_start_pos + 134`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
......@@ -121,18 +121,18 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
let $start_pos= `select @binlog_start_pos + 694`;
let $start_pos= `select @binlog_start_pos + 696`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
let $stop_pos= `select @binlog_start_pos + 694`;
let $stop_pos= `select @binlog_start_pos + 696`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
let $start_pos= `select @binlog_start_pos + 694`;
let $stop_pos= `select @binlog_start_pos + 810`;
let $start_pos= `select @binlog_start_pos + 696`;
let $stop_pos= `select @binlog_start_pos + 812`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
......@@ -156,12 +156,12 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
let $start_pos= `select @binlog_start_pos + 694`;
let $start_pos= `select @binlog_start_pos + 696`;
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
let $stop_pos= `select @binlog_start_pos + 107`;
let $stop_pos= `select @binlog_start_pos + 109`;
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
......
......@@ -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 484
master-bin.000001 486
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
Binlog_snapshot_position 484
Binlog_snapshot_position 486
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 986
Binlog_snapshot_position 988
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 1338
master-bin.000001 1340
SELECT * FROM t2 ORDER BY a;
a
2
......@@ -60,7 +60,7 @@ a b
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
Binlog_snapshot_position 986
Binlog_snapshot_position 988
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 367
......@@ -75,33 +75,33 @@ 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 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
master-bin.000001 248 Gtid_list 1 273 []
master-bin.000001 273 Binlog_checkpoint 1 313 master-bin.000001
master-bin.000001 313 Gtid 1 351 GTID 0-1-1
master-bin.000001 351 Query 1 486 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
master-bin.000001 486 Gtid 1 524 GTID 0-1-2
master-bin.000001 524 Query 1 636 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
master-bin.000001 636 Gtid 1 674 BEGIN GTID 0-1-3
master-bin.000001 674 Query 1 762 use `test`; INSERT INTO t2 VALUES (2)
master-bin.000001 762 Query 1 831 COMMIT
master-bin.000001 831 Gtid 1 869 BEGIN GTID 0-1-4
master-bin.000001 869 Query 1 961 use `test`; INSERT INTO t1 VALUES (0, "")
master-bin.000001 961 Xid 1 988 COMMIT /* XID */
master-bin.000001 988 Gtid 1 1026 BEGIN GTID 0-1-5
master-bin.000001 1026 Query 1 1114 use `test`; INSERT INTO t2 VALUES (3)
master-bin.000001 1114 Query 1 1183 COMMIT
master-bin.000001 1183 Gtid 1 1221 BEGIN GTID 0-1-6
master-bin.000001 1221 Query 1 1313 use `test`; INSERT INTO t1 VALUES (4, "")
master-bin.000001 1313 Xid 1 1340 COMMIT /* XID */
master-bin.000001 1340 Gtid 1 1378 BEGIN GTID 0-1-7
master-bin.000001 1378 Query 1 1470 use `test`; INSERT INTO t1 VALUES (1, "")
master-bin.000001 1470 Xid 1 1497 COMMIT /* XID */
master-bin.000001 1497 Gtid 1 1535 BEGIN GTID 0-1-8
master-bin.000001 1535 Query 1 1632 use `test`; INSERT INTO t1 VALUES (2, "first")
master-bin.000001 1632 Query 1 1730 use `test`; INSERT INTO t1 VALUES (2, "second")
master-bin.000001 1730 Xid 1 1757 COMMIT /* XID */
master-bin.000001 1757 Gtid 1 1795 BEGIN GTID 0-1-9
master-bin.000001 1795 Query 1 1887 use `test`; INSERT INTO t1 VALUES (3, "")
master-bin.000001 1887 Xid 1 1914 COMMIT /* XID */
master-bin.000001 1914 Rotate 1 1958 master-bin.000002;pos=4
DROP TABLE t1,t2;
......@@ -31,6 +31,6 @@ a
1
2
3
InnoDB: Last MySQL binlog file position 0 920, file name ./master-bin.000001
InnoDB: Last MySQL binlog file position 0 922, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
......@@ -32,6 +32,6 @@ a
1
2
3
InnoDB: Last MySQL binlog file position 0 920, file name ./master-bin.000001
InnoDB: Last MySQL binlog file position 0 922, file name ./master-bin.000001
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
......@@ -35,9 +35,9 @@ Master_User root
Master_Port MYPORT_3
Connect_Retry 60
Master_Log_File server3-bin.000001
Read_Master_Log_Pos 1499
Read_Master_Log_Pos 1501
Relay_Log_File mysqld-relay-bin.000002
Relay_Log_Pos 1788
Relay_Log_Pos 1790
Relay_Master_Log_File server3-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
......@@ -50,8 +50,8 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 1499
Relay_Log_Space 2086
Exec_Master_Log_Pos 1501
Relay_Log_Space 2088
Until_Condition None
Until_Log_File
Until_Log_Pos 0
......
......@@ -85,16 +85,16 @@ MASTER 2.2
#
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 Using_Gtid 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 311 relay.000002 599 master-bin.000001 Yes Yes 0 0 311 886 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 311 relay-master@00202@002e2.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
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
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 Using_Gtid 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 311 relay.000004 536 master-bin.000001 Yes Yes 0 0 311 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 311 relay-master@00202@002e2.000004 536 master-bin.000001 Yes Yes 0 0 311 842 None 0 No 0 No 0 0 2 No 0 1073741824 6 0 60.000
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
#
# List of files matching '*info*' pattern
# after slave server restart
......
......@@ -15,12 +15,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000002 4 Format_desc 3 248 Server version
mysqld-relay-bin-master1.000002 248 Rotate 1 0 master-bin.000001;pos=4
mysqld-relay-bin-master1.000002 292 Format_desc 1 248 Server version
mysqld-relay-bin-master1.000002 536 Gtid_list 1 271 []
mysqld-relay-bin-master1.000002 559 Binlog_checkpoint 1 311 master-bin.000001
mysqld-relay-bin-master1.000002 599 Gtid 1 349 GTID 0-1-1
mysqld-relay-bin-master1.000002 637 Query 1 463 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
mysqld-relay-bin-master1.000002 751 Gtid 1 501 GTID 0-1-2
mysqld-relay-bin-master1.000002 789 Query 1 601 use `test`; create table t1 (i int) engine=MyISAM
mysqld-relay-bin-master1.000002 536 Gtid_list 1 273 []
mysqld-relay-bin-master1.000002 561 Binlog_checkpoint 1 313 master-bin.000001
mysqld-relay-bin-master1.000002 601 Gtid 1 351 GTID 0-1-1
mysqld-relay-bin-master1.000002 639 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
mysqld-relay-bin-master1.000002 753 Gtid 1 503 GTID 0-1-2
mysqld-relay-bin-master1.000002 791 Query 1 603 use `test`; create table t1 (i int) engine=MyISAM
show relaylog events;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000001 4 Format_desc 3 248 Server version
......
......@@ -11,14 +11,14 @@ 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 Using_Gtid
127.0.0.1 root MYPORT_1 60 master-bin.000001 800 mysqld-relay-bin-master1.000002 1088 master-bin.000001 No No 0 0 800 1394 None 0 No NULL No 0 0 1 No
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
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 Using_Gtid
127.0.0.1 root MYPORT_1 60 4 1088 No No 0 0 0 1394 None 0 No NULL No 0 0 1 No
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
reset slave 'master1' all;
show slave 'master1' status;
ERROR HY000: There is no master connection 'master1'
......
......@@ -11,8 +11,8 @@ 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 Using_Gtid 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 311 mysqld-relay-bin-slave1.000002 599 master-bin.000001 Yes Yes 0 0 311 904 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 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
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
start all slaves;
stop slave 'slave1';
show slave 'slave1' status;
......@@ -22,9 +22,9 @@ Master_User root
Master_Port MYPORT_1
Connect_Retry 60
Master_Log_File master-bin.000001
Read_Master_Log_Pos 311
Read_Master_Log_Pos 313
Relay_Log_File mysqld-relay-bin-slave1.000002
Relay_Log_Pos 599
Relay_Log_Pos 601
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running No
......@@ -37,8 +37,8 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 311
Relay_Log_Space 904
Exec_Master_Log_Pos 313
Relay_Log_Space 906
Until_Condition None
Until_Log_File
Until_Log_Pos 0
......@@ -60,18 +60,18 @@ Using_Gtid No
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 Using_Gtid 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 599 No No 0 0 0 904 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 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000
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
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 Using_Gtid 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 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 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
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 Using_Gtid 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 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 No No 0 0 311 904 None 0 No NULL No 0 0 2 No 0 1073741824 7 0 60.000
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
stop all slaves;
include/reset_master_slave.inc
include/reset_master_slave.inc
......
......@@ -2,65 +2,66 @@ include/master-slave.inc
[connection master]
set @old_master_binlog_checksum= @@global.binlog_checksum;
set @old_slave_dbug= @@global.debug_dbug;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (0);
# Test slave with no capability gets dummy event, which is ignored.
include/stop_slave.inc
# Test slave with no capability gets dummy event, which is ignored.
SET @@global.debug_dbug='+d,simulate_slave_capability_none';
include/start_slave.inc
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (0);
ALTER TABLE t1 ORDER BY a;
SET SESSION binlog_annotate_row_events = ON;
DELETE FROM t1;
INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1);
show binlog events in 'master-bin.000001' from <binlog_start> limit 0, 10;
show binlog events in 'master-bin.000002' from <binlog_start> limit 0, 10;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # DELETE FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Annotate_rows # # DELETE FROM t1
master-bin.000002 # Table_map # # table_id: # (test.t1)
master-bin.000002 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Annotate_rows # # INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1)
master-bin.000002 # Table_map # # table_id: # (test.t1)
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000002 # Query # # COMMIT
SELECT * FROM t1;
a
1
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 0,10;
show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 0,10;
Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Query # # BEGIN
slave-relay-bin.000003 # User var # # @`!dummyvar`=NULL
slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000003 # Delete_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000003 # Query # # COMMIT
slave-relay-bin.000003 # Query # # BEGIN
slave-relay-bin.000003 # Query # # # Dummy event replacing event type 160 that slave cannot handle.
slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000003 # Query # # COMMIT
slave-relay-bin.000005 # Query # # BEGIN
slave-relay-bin.000005 # User var # # @`!dummyvar`=NULL
slave-relay-bin.000005 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000005 # Delete_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000005 # Query # # COMMIT
slave-relay-bin.000005 # Query # # BEGIN
slave-relay-bin.000005 # Query # # # Dummy event replacing event type 160 that slave cannot handle.
slave-relay-bin.000005 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000005 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000005 # Query # # COMMIT
set @@global.debug_dbug= @old_slave_dbug;
# Test dummy event is checksummed correctly.
set @@global.binlog_checksum = CRC32;
TRUNCATE t1;
INSERT INTO t1 VALUES(2);
show binlog events in 'master-bin.000002' from <binlog_start> limit 0, 5;
show binlog events in 'master-bin.000003' from <binlog_start> limit 0, 5;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Annotate_rows # # INSERT INTO t1 VALUES(2)
master-bin.000002 # Table_map # # table_id: # (test.t1)
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000002 # Query # # COMMIT
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
master-bin.000003 # Annotate_rows # # INSERT INTO t1 VALUES(2)
master-bin.000003 # Table_map # # table_id: # (test.t1)
master-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000003 # Query # # COMMIT
SELECT * FROM t1;
a
2
show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 7,5;
show relaylog events in 'slave-relay-bin.000007' from <binlog_start> limit 7,5;
Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000005 # Query # # BEGIN
slave-relay-bin.000005 # Query # # # Dummy ev
slave-relay-bin.000005 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000005 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000005 # Query # # COMMIT
slave-relay-bin.000007 # Query # # BEGIN
slave-relay-bin.000007 # Query # # # Dummy ev
slave-relay-bin.000007 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000007 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000007 # Query # # COMMIT
# Test that slave which cannot tolerate holes in binlog stream but
# knows the event does not get dummy event
include/stop_slave.inc
......@@ -68,23 +69,23 @@ SET @@global.debug_dbug='+d,simulate_slave_capability_old_53';
include/start_slave.inc
ALTER TABLE t1 ORDER BY a;
UPDATE t1 SET a = 3;
show binlog events in 'master-bin.000002' from <binlog_start> limit 0, 5;
show binlog events in 'master-bin.000003' from <binlog_start> limit 0, 5;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Annotate_rows # # UPDATE t1 SET a = 3
master-bin.000002 # Table_map # # table_id: # (test.t1)
master-bin.000002 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000002 # Query # # COMMIT
master-bin.000003 # Gtid # # BEGIN GTID #-#-#
master-bin.000003 # Annotate_rows # # UPDATE t1 SET a = 3
master-bin.000003 # Table_map # # table_id: # (test.t1)
master-bin.000003 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000003 # Query # # COMMIT
SELECT * FROM t1;
a
3
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 0,5;
show relaylog events in 'slave-relay-bin.000008' from <binlog_start> limit 0,5;
Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Query # # BEGIN
slave-relay-bin.000006 # Annotate_rows # # UPDATE t1 SET a = 3
slave-relay-bin.000006 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000006 # Update_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000006 # Query # # COMMIT
slave-relay-bin.000008 # Query # # BEGIN
slave-relay-bin.000008 # Annotate_rows # # UPDATE t1 SET a = 3
slave-relay-bin.000008 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000008 # Update_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000008 # Query # # COMMIT
select @@global.log_slave_updates;
@@global.log_slave_updates
1
......
......@@ -6,16 +6,23 @@ connection master;
set @old_master_binlog_checksum= @@global.binlog_checksum;
set @old_slave_dbug= @@global.debug_dbug;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (0);
sync_slave_with_master;
# MDEV-4475: Cannot replicate to old server when binlog contains
# empty Gtid_list event
#
# Test this by binlog rotation before we log any GTIDs.
connection slave;
--echo # Test slave with no capability gets dummy event, which is ignored.
--source include/stop_slave.inc
--echo # Test slave with no capability gets dummy event, which is ignored.
SET @@global.debug_dbug='+d,simulate_slave_capability_none';
--source include/start_slave.inc
connection master;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (0);
sync_slave_with_master;
connection master;
# Add a dummy event just to have something to sync_slave_with_master on.
# Otherwise we occasionally get different $relaylog_start, depending on
......
......@@ -6374,7 +6374,7 @@ Gtid_list_log_event::to_packet(String *packet)
DBUG_ASSERT(count < 1<<28);
needed_length= packet->length() + 4 + count*element_size;
needed_length= packet->length() + get_data_size();
if (packet->reserve(needed_length))
return true;
p= (uchar *)packet->ptr() + packet->length();;
......
......@@ -3181,7 +3181,14 @@ public:
const Format_description_log_event *description_event);
~Gtid_list_log_event() { my_free(list); }
Log_event_type get_type_code() { return GTID_LIST_EVENT; }
int get_data_size() { return GTID_LIST_HEADER_LEN + count*element_size; }
int get_data_size() {
/*
Replacing with dummy event, needed for older slaves, requires a minimum
of 6 bytes in the body.
*/
return (count==0 ?
GTID_LIST_HEADER_LEN+2 : GTID_LIST_HEADER_LEN+count*element_size);
}
bool is_valid() const { return list != NULL; }
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
bool to_packet(String *packet);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment