diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-07-10 12:01:52 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-07-10 12:01:52 +0200 |
commit | 2f6a2494a5eb2cf3ab06fbedd2584eca85d90230 (patch) | |
tree | 8d9d75502c8b64a769f3931f5801092392667b1d | |
parent | 1e43277838581dfa5be2e755e524991cd7e2cebf (diff) | |
download | mariadb-git-2f6a2494a5eb2cf3ab06fbedd2584eca85d90230.tar.gz |
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 ... :-/
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result | 7 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test | 12 | ||||
-rw-r--r-- | sql/sql_repl.cc | 4 |
3 files changed, 14 insertions, 9 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result index d6a826ffaaa..7f27f2bdeee 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result @@ -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 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test b/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test index ceb79062155..1e33520efb5 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test @@ -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 diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index fcda6452e92..21634ac6dfc 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -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; |