diff --git a/mysql-test/suite/rpl/r/rpl_relay_log_init.result b/mysql-test/suite/rpl/r/rpl_relay_log_init.result new file mode 100644 index 0000000..d7ee744 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_relay_log_init.result @@ -0,0 +1,29 @@ +include/master-slave.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +[connection master] +SET @save_binlog_checksum= @@GLOBAL.binlog_checksum; +SET @@GLOBAL.binlog_checksum = 'NONE'; +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (1); +[connection slave] +SET @save_binlog_checksum= @@GLOBAL.binlog_checksum; +SET @@GLOBAL.binlog_checksum = 'NONE'; +include/rpl_reset.inc +[connection master] +SET @@GLOBAL.binlog_checksum = 'CRC32'; +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +[connection slave] +include/start_slave_io.inc +START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS = "MASTER_UUID:2"; +include/wait_for_slave_sql_to_stop.inc +include/start_slave_sql.inc +[connection master] +DROP TABLE t1; +SET @@GLOBAL.binlog_checksum = @save_binlog_checksum; +[connection slave] +SET @@GLOBAL.binlog_checksum = @save_binlog_checksum; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_relay_log_init.test b/mysql-test/suite/rpl/t/rpl_relay_log_init.test new file mode 100644 index 0000000..a9f1cbc --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_relay_log_init.test @@ -0,0 +1,37 @@ +--source include/master-slave.inc +--source include/have_gtid.inc + +--source include/rpl_connection_master.inc +--let $master_uuid = `SELECT @@GLOBAL.SERVER_UUID` +SET @save_binlog_checksum= @@GLOBAL.binlog_checksum; +SET @@GLOBAL.binlog_checksum = 'NONE'; +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (1); + +--source include/rpl_connection_slave.inc +SET @save_binlog_checksum= @@GLOBAL.binlog_checksum; +SET @@GLOBAL.binlog_checksum = 'NONE'; + +--let $rpl_no_start_slave= 1 +--source include/rpl_reset.inc + +--source include/rpl_connection_master.inc +SET @@GLOBAL.binlog_checksum = 'CRC32'; +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); + +--source include/rpl_connection_slave.inc +--source include/start_slave_io.inc +--replace_result $master_uuid MASTER_UUID +--eval START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS = "$master_uuid:2" +--source include/wait_for_slave_sql_to_stop.inc +--source include/start_slave_sql.inc + +--source include/rpl_connection_master.inc +DROP TABLE t1; +SET @@GLOBAL.binlog_checksum = @save_binlog_checksum; + +--source include/rpl_connection_slave.inc +SET @@GLOBAL.binlog_checksum = @save_binlog_checksum; + +--source include/rpl_end.inc diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index dc058f3..107ed89 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -537,23 +537,25 @@ int Relay_log_info::init_relay_log_pos(const char* log, describes the whole relay log; indeed, one can have this sequence (starting from position 4): Format_desc (of slave) + Previous_gtids (if gtid_mode > 0) Rotate (of master) Format_desc (of master) So the Format_desc which really describes the rest of the relay log - is the 3rd event (it can't be further than that, because we rotate - the relay log when we queue a Rotate event from the master). + is the 3rd or 4th event (it can't be further than that, because we + rotate the relay log when we queue a Rotate event from the master). But what describes the Rotate is the first Format_desc. So what we do is: go on searching for Format_description events, until you exceed the - position (argument 'pos') or until you find another event than Rotate - or Format_desc. + position (argument 'pos') or until finding an event other than Rotate, + Format_desc, or Previous_gtids. */ } else { DBUG_PRINT("info",("found event of another type=%d", ev->get_type_code())); - look_for_description_event= (ev->get_type_code() == ROTATE_EVENT); + look_for_description_event= (ev->get_type_code() == ROTATE_EVENT || + ev->get_type_code() == PREVIOUS_GTIDS_LOG_EVENT); delete ev; } }