MDEV-4708: GTID strict mode doesn't work on a database with purged binlogs
When a new master is provisioned that does not have any old binlogs, the @@gtid_slave_pos is used to know where in the GTID history the provisioning happened. A slave is allowed to connect at the point of this value of @@gtid_slave_pos, even if that GTID is not in the binlogs on the new master. The code to handle this case when the binlog on the newly provisioned master is completely empty was just wrong (couple of typos). Clearly it had never been tested ... :-/
This commit is contained in:
parent
1e43277838
commit
2f6a2494a5
@ -17,6 +17,10 @@ a b
|
||||
1 1
|
||||
2 1
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_PORT,
|
||||
master_user = 'root', master_use_gtid = current_pos;
|
||||
START SLAVE;
|
||||
include/wait_for_slave_to_start.inc
|
||||
INSERT INTO t1 VALUES (3, 2);
|
||||
INSERT INTO t1 VALUES (4, 2);
|
||||
show binlog events from <binlog_start>;
|
||||
@ -27,9 +31,6 @@ slave-bin.000001 # Query # # COMMIT
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4, 2)
|
||||
slave-bin.000001 # Query # # COMMIT
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_PORT,
|
||||
master_user = 'root', master_use_gtid = current_pos;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
|
@ -22,16 +22,20 @@ SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--connection server_1
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT,
|
||||
master_user = 'root', master_use_gtid = current_pos;
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
--connection server_2
|
||||
INSERT INTO t1 VALUES (3, 2);
|
||||
INSERT INTO t1 VALUES (4, 2);
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--connection server_1
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT,
|
||||
master_user = 'root', master_use_gtid = current_pos;
|
||||
START SLAVE;
|
||||
--let $wait_condition= SELECT COUNT(*) = 4 FROM t1
|
||||
--source include/wait_condition.inc
|
||||
|
||||
|
@ -1042,8 +1042,8 @@ check_slave_start_position(THD *thd, slave_connection_state *st,
|
||||
*/
|
||||
if (!delete_list)
|
||||
{
|
||||
if ((delete_list= (rpl_gtid **)my_malloc(sizeof(*delete_list),
|
||||
MYF(MY_WME))))
|
||||
if (!(delete_list= (rpl_gtid **)
|
||||
my_malloc(sizeof(*delete_list) * st->hash.records, MYF(MY_WME))))
|
||||
{
|
||||
*errormsg= "Out of memory while checking slave start position";
|
||||
err= ER_OUT_OF_RESOURCES;
|
||||
|
Loading…
x
Reference in New Issue
Block a user