Commit 850c77b7 authored by Elena Stepanova's avatar Elena Stepanova

Added calls for BINLOG_GTID_POS() function to the basic GTID test case

parent 748e8a35
include/rpl_init.inc [topology=1->2->3->4] 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 t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, "m1"); INSERT INTO t1 VALUES (1, "m1");
...@@ -8,6 +12,14 @@ BEGIN; ...@@ -8,6 +12,14 @@ BEGIN;
INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); INSERT INTO t2 VALUES (2, "i2"), (3, "i3");
INSERT INTO t2 VALUES (4, "i4"); INSERT INTO t2 VALUES (4, "i4");
COMMIT; 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; SELECT * FROM t1 ORDER BY a;
a b a b
1 m1 1 m1
...@@ -115,4 +127,39 @@ include/stop_slave.inc ...@@ -115,4 +127,39 @@ include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3;
include/start_slave.inc include/start_slave.inc
DROP TABLE t1,t2; 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.
include/rpl_end.inc include/rpl_end.inc
...@@ -8,6 +8,13 @@ ...@@ -8,6 +8,13 @@
# A -> B -> C -> D # A -> B -> C -> D
connection server_1; connection server_1;
--source include/wait_for_binlog_checkpoint.inc
--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
--echo *** GTID position should be empty here ***
--replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS>
eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, "m1"); INSERT INTO t1 VALUES (1, "m1");
...@@ -18,9 +25,22 @@ INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); ...@@ -18,9 +25,22 @@ INSERT INTO t2 VALUES (2, "i2"), (3, "i3");
INSERT INTO t2 VALUES (4, "i4"); INSERT INTO t2 VALUES (4, "i4");
COMMIT; COMMIT;
save_master_pos; save_master_pos;
source include/wait_for_binlog_checkpoint.inc;
--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
--let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos`
--echo *** GTID position should be non-empty here ***
--replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS> $gtid_pos_server_1 <GTID_POS_SERVER_1>
eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
connection server_2; connection server_2;
sync_with_master; sync_with_master;
source include/wait_for_binlog_checkpoint.inc;
--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
--echo *** GTID position should be the same as on server_1 ***
--replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS> $gtid_pos_server_1 <GTID_POS_SERVER_1>
eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
SELECT * FROM t1 ORDER BY a; SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a; SELECT * FROM t2 ORDER BY a;
save_master_pos; save_master_pos;
...@@ -123,4 +143,21 @@ eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3; ...@@ -123,4 +143,21 @@ eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3;
connection server_1; connection server_1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo *** A few more checks for BINLOG_GTID_POS function ***
--let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1)
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT BINLOG_GTID_POS();
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT BINLOG_GTID_POS('a');
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT BINLOG_GTID_POS('a',1,NULL);
SELECT BINLOG_GTID_POS(1,'a');
SELECT BINLOG_GTID_POS(NULL,NULL);
SELECT BINLOG_GTID_POS('',1);
SELECT BINLOG_GTID_POS('a',1);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
--source include/rpl_end.inc --source include/rpl_end.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment