mariadb/mysql-test/suite/rpl/r/rpl_gtid_basic.result

206 lines
5.3 KiB
Text
Raw Normal View History

include/rpl_init.inc [topology=1->2->3->4]
*** GTID position should be empty here ***
SELECT BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>);
BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>)
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, "m1");
INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4");
INSERT INTO t2 VALUES (1, "i1");
BEGIN;
INSERT INTO t2 VALUES (2, "i2"), (3, "i3");
INSERT INTO t2 VALUES (4, "i4");
COMMIT;
*** GTID position should be non-empty here ***
SELECT BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>);
BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>)
<GTID_POS_SERVER_1>
*** GTID position should be the same as on server_1 ***
SELECT BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>);
BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>)
<GTID_POS_SERVER_1>
SELECT * FROM t1 ORDER BY a;
a b
1 m1
2 m2
3 m3
4 m4
SELECT * FROM t2 ORDER BY a;
a b
1 i1
2 i2
3 i3
4 i4
SELECT * FROM t1 ORDER BY a;
a b
1 m1
2 m2
3 m3
4 m4
SELECT * FROM t2 ORDER BY a;
a b
1 i1
2 i2
3 i3
4 i4
SELECT * FROM t1 ORDER BY a;
a b
1 m1
2 m2
3 m3
4 m4
SELECT * FROM t2 ORDER BY a;
a b
1 i1
2 i2
3 i3
4 i4
*** Now take out D, let it fall behind a bit, and then test re-attaching it to A ***
include/stop_slave.inc
INSERT INTO t1 VALUES (5, "m1a");
INSERT INTO t2 VALUES (5, "i1a");
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a b
1 m1
2 m2
3 m3
4 m4
5 m1a
SELECT * FROM t2 ORDER BY a;
a b
1 i1
2 i2
3 i3
4 i4
5 i1a
*** Now move B to D (C is still replicating from B) ***
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
MASTER_USE_GTID=CURRENT_POS;
include/start_slave.inc
UPDATE t2 SET b="j1a" WHERE a=5;
SELECT * FROM t1 ORDER BY a;
a b
1 m1
2 m2
3 m3
4 m4
5 m1a
SELECT * FROM t2 ORDER BY a;
a b
1 i1
2 i2
3 i3
4 i4
5 j1a
*** Now move C to D, after letting it fall a little behind ***
include/stop_slave.inc
BEGIN;
INSERT INTO t2 VALUES (6, "i6b");
INSERT INTO t2 VALUES (7, "i7b");
COMMIT;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
MASTER_USE_GTID=CURRENT_POS;
include/start_slave.inc
SELECT * FROM t2 ORDER BY a;
a b
1 i1
2 i2
3 i3
4 i4
5 j1a
6 i6b
7 i7b
*** Now change everything back to what it was, to make rpl_end.inc happy
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_MYPORT;
include/start_slave.inc
include/wait_for_slave_to_start.inc
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_MYPORT;
include/start_slave.inc
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3;
include/start_slave.inc
DROP TABLE t1,t2;
*** A few more checks for BINLOG_GTID_POS function ***
SELECT BINLOG_GTID_POS();
ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS'
SELECT BINLOG_GTID_POS('a');
ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS'
SELECT BINLOG_GTID_POS('a',1,NULL);
ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS'
SELECT BINLOG_GTID_POS(1,'a');
BINLOG_GTID_POS(1,'a')
NULL
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'a'
SELECT BINLOG_GTID_POS(NULL,NULL);
BINLOG_GTID_POS(NULL,NULL)
NULL
SELECT BINLOG_GTID_POS('',1);
BINLOG_GTID_POS('',1)
SELECT BINLOG_GTID_POS('a',1);
BINLOG_GTID_POS('a',1)
NULL
SELECT BINLOG_GTID_POS('master-bin.000001',-1);
BINLOG_GTID_POS('master-bin.000001',-1)
NULL
SELECT BINLOG_GTID_POS('master-bin.000001',0);
BINLOG_GTID_POS('master-bin.000001',0)
SELECT BINLOG_GTID_POS('master-bin.000001',18446744073709551615);
BINLOG_GTID_POS('master-bin.000001',18446744073709551615)
NULL
SELECT BINLOG_GTID_POS('master-bin.000001',18446744073709551616);
BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
*** Some tests of @@GLOBAL.gtid_binlog_state ***
include/stop_slave.inc
SET @old_state= @@GLOBAL.gtid_binlog_state;
SET GLOBAL gtid_binlog_state = '';
ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log
RESET MASTER;
SET GLOBAL gtid_binlog_state = '';
FLUSH LOGS;
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30';
show binary logs;
Log_name File_size
master-bin.000001 #
show binlog events in 'master-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
master-bin.000001 # Gtid_list # # [1-2-20,0-1-10,0-3-30]
master-bin.000001 # Binlog_checkpoint # # master-bin.000001
SELECT @@GLOBAL.gtid_binlog_pos;
@@GLOBAL.gtid_binlog_pos
1-2-20,0-3-30
SELECT @@GLOBAL.gtid_binlog_state;
@@GLOBAL.gtid_binlog_state
1-2-20,0-1-10,0-3-30
SET GLOBAL gtid_binlog_state = @old_state;
ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log
RESET MASTER;
SET GLOBAL gtid_binlog_state = @old_state;
CREATE TABLE t1 (a INT PRIMARY KEY);
SET gtid_seq_no=100;
INSERT INTO t1 VALUES (1);
include/start_slave.inc
SELECT * FROM t1;
a
1
Gtid_IO_Pos = '0-1-100'
DROP TABLE t1;
include/rpl_end.inc