summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-04-04 17:38:10 +0200
committerunknown <knielsen@knielsen-hq.org>2013-04-04 17:38:10 +0200
commitc2cbc9cee6a3f8f745501ee2f5fcfd4586f53bbd (patch)
treeb779d3a554d9f69556e1a805b46bf27261a5c451 /mysql-test
parentbdf6367d0e019703b48c62b1ae5728e48ba0eba7 (diff)
downloadmariadb-git-c2cbc9cee6a3f8f745501ee2f5fcfd4586f53bbd.tar.gz
MDEV-26: Global transaction ID.
Move combining slave and gtid binlog state into a separate function. Make SHOW ALL SLAVES STATUS use the same function, so it shows the same value used by slave connect. Add a test case.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_startpos.result34
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_startpos.test40
2 files changed, 74 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
index 1e18f4506c7..911f5ad3909 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
@@ -149,5 +149,39 @@ a
3
4
5
+*** Test modifying binlog on slave and the effect on GTID state. ***
+include/stop_slave.inc
+RESET MASTER;
+CHANGE MASTER TO master_gtid_pos='';
+RESET MASTER;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (10);
+include/start_slave.inc
+SELECT * FROM t1;
+a
+10
+SELECT '1' AS Using_Gtid;
+Using_Gtid
+1
+SELECT '0-1-2' AS Gtid_Pos;
+Gtid_Pos
+0-1-2
+UPDATE t1 SET a=9 WHERE a=10;
+UPDATE t1 SET a=10 WHERE a=9;
+SELECT '0-2-4' AS Gtid_Pos;
+Gtid_Pos
+0-2-4
+include/stop_slave.inc
+CHANGE MASTER TO master_gtid_pos= '0-1-2';
+ERROR HY000: Requested MASTER_GTID_POS 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. To use the requested MASTER_GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
+RESET MASTER;
+SELECT '0-1-2' AS Gtid_Pos;
+Gtid_Pos
+0-1-2
+CHANGE MASTER TO master_gtid_pos= '0-1-2';
+include/start_slave.inc
+SELECT '0-1-2' AS Gtid_Pos;
+Gtid_Pos
+0-1-2
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
index e2624051b69..a5200de46ec 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
@@ -240,6 +240,46 @@ eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT;
SELECT * FROM t1 ORDER BY a;
+--echo *** Test modifying binlog on slave and the effect on GTID state. ***
+
+--connection server_2
+--source include/stop_slave.inc
+RESET MASTER;
+CHANGE MASTER TO master_gtid_pos='';
+
+--connection server_1
+RESET MASTER;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES (10); # Will be GTID 0-1-2
+--save_master_pos
+
+--connection server_2
+--source include/start_slave.inc
+--sync_with_master
+
+SELECT * FROM t1;
+--let $value= query_get_value(SHOW SLAVE STATUS, "Using_Gtid", 1)
+eval SELECT '$value' AS Using_Gtid;
+--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1)
+eval SELECT '$value' AS Gtid_Pos;
+
+UPDATE t1 SET a=9 WHERE a=10;
+UPDATE t1 SET a=10 WHERE a=9;
+
+--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1)
+eval SELECT '$value' AS Gtid_Pos;
+
+--source include/stop_slave.inc
+--error ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG
+CHANGE MASTER TO master_gtid_pos= '0-1-2';
+RESET MASTER;
+--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1)
+eval SELECT '$value' AS Gtid_Pos;
+CHANGE MASTER TO master_gtid_pos= '0-1-2';
+--source include/start_slave.inc
+--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1)
+eval SELECT '$value' AS Gtid_Pos;
+
# Clean up.
--connection server_1
DROP TABLE t1;