mirror of
https://github.com/MariaDB/server.git
synced 2025-12-06 05:42:06 +03:00
Galera GTID support
Support for galera GTID consistency thru cluster. All nodes in cluster should have same GTID for replicated events which are originating from cluster. Cluster originating commands need to contain sequential WSREP GTID seqno Ignore manual setting of gtid_seq_no=X. In master-slave scenario where master is non galera node replicated GTID is replicated and is preserved in all nodes. To have this - domain_id, server_id and seqnos should be same on all nodes. Node which bootstraps the cluster, to achieve this, sends domain_id and server_id to other nodes and this combination is used to write GTID for events that are replicated inside cluster. Cluster nodes that are executing non replicated events are going to have different GTID than replicated ones, difference will be visible in domain part of gtid. With wsrep_gtid_domain_id you can set domain_id for WSREP cluster. Functions WSREP_LAST_WRITTEN_GTID, WSREP_LAST_SEEN_GTID and WSREP_SYNC_WAIT_UPTO_GTID now works with "native" GTID format. Fixed galera tests to reflect this chances. Add variable to manually update WSREP GTID seqno in cluster Add variable to manipulate and change WSREP GTID seqno. Next command originating from cluster and on same thread will have set seqno and cluster should change their internal counter to it's value. Behavior is same as using @@gtid_seq_no for non WSREP transaction.
This commit is contained in:
@@ -21,8 +21,6 @@ MW-329 : MDEV-19962 Galera test failure on MW-329
|
||||
MW-360 : needs rewrite to be MariaDB gtid compatible
|
||||
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
|
||||
galera_account_management : MariaDB 10.0 does not support ALTER USER
|
||||
galera_as_master_gtid : Requires MySQL GTID
|
||||
galera_as_master_gtid_change_master : Requires MySQL GTID
|
||||
galera_as_slave_gtid_myisam : MDEV-21421 galera.galera_as_slave_gtid_myisam
|
||||
galera_as_slave_gtid_replicate_do_db_cc : Requires MySQL GTID
|
||||
galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
|
||||
|
||||
28
mysql-test/suite/galera/r/MDEV-10715.result
Normal file
28
mysql-test/suite/galera/r/MDEV-10715.result
Normal file
@@ -0,0 +1,28 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
connection node_1;
|
||||
create table t1(a int);
|
||||
set @@wsrep_gtid_seq_no=22;
|
||||
insert into t1 values(1);
|
||||
insert into t1 values(2);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-23
|
||||
select wsrep_last_seen_gtid();
|
||||
wsrep_last_seen_gtid()
|
||||
1-1-23
|
||||
select wsrep_last_written_gtid();
|
||||
wsrep_last_written_gtid()
|
||||
1-1-23
|
||||
connection node_2;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-23
|
||||
select wsrep_last_seen_gtid();
|
||||
wsrep_last_seen_gtid()
|
||||
1-1-23
|
||||
select wsrep_last_written_gtid();
|
||||
wsrep_last_written_gtid()
|
||||
1-1-0
|
||||
connection node_1;
|
||||
drop table t1;
|
||||
@@ -1,22 +1,28 @@
|
||||
START SLAVE USER='root';
|
||||
Warnings:
|
||||
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
|
||||
START SLAVE;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
uuids_do_not_match
|
||||
1
|
||||
SELECT @@global.gtid_binlog_pos;
|
||||
@@global.gtid_binlog_pos
|
||||
100-1-2
|
||||
connection node_2;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
uuids_do_not_match
|
||||
gtid_do_not_match
|
||||
1
|
||||
uuids_match
|
||||
1
|
||||
uuids_do_not_match
|
||||
1
|
||||
uuids_match
|
||||
connection node_3;
|
||||
gtid_do_not_match
|
||||
1
|
||||
connection node_1;
|
||||
DROP TABLE t1;
|
||||
connection node_3;
|
||||
connection node_1;
|
||||
connection node_2;
|
||||
gtid_executed_equal
|
||||
1
|
||||
connection node_3;
|
||||
gtid_executed_equal
|
||||
1
|
||||
STOP SLAVE;
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
START SLAVE USER='root';
|
||||
Warnings:
|
||||
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
|
||||
START SLAVE;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
connection node_2;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
connection node_3;
|
||||
STOP SLAVE;
|
||||
START SLAVE USER='root';
|
||||
Warnings:
|
||||
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
|
||||
START SLAVE;
|
||||
connection node_1;
|
||||
INSERT INTO t1 VALUES(3);
|
||||
connection node_2;
|
||||
INSERT INTO t1 VALUES(4);
|
||||
connection node_3;
|
||||
connection node_1;
|
||||
DROP TABLE t1;
|
||||
connection node_3;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE ALL;
|
||||
RESET MASTER;
|
||||
connection node_2;
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
connection node_1;
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
|
||||
@@ -97,34 +97,34 @@ master-bin.000001 256 Gtid_list 1 285 []
|
||||
master-bin.000001 285 Binlog_checkpoint 1 329 master-bin.000001
|
||||
master-bin.000001 329 Gtid 3 371 GTID 0-3-1
|
||||
master-bin.000001 371 Query 3 458 CREATE SCHEMA test1
|
||||
master-bin.000001 458 Gtid 3 500 GTID 0-3-2
|
||||
master-bin.000001 458 Gtid 3 500 GTID 0-3-3
|
||||
master-bin.000001 500 Query 3 647 use `test1`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB
|
||||
master-bin.000001 647 Gtid 3 689 BEGIN GTID 0-3-3
|
||||
master-bin.000001 647 Gtid 3 689 BEGIN GTID 0-3-5
|
||||
master-bin.000001 689 Annotate_rows 3 748 INSERT INTO test1.t1 (f1) VALUES (1)
|
||||
master-bin.000001 748 Table_map 3 797 table_id: ### (test1.t1)
|
||||
master-bin.000001 797 Write_rows_v1 3 839 table_id: ### flags: STMT_END_F
|
||||
master-bin.000001 839 Xid 3 870 COMMIT /* xid=### */
|
||||
master-bin.000001 870 Gtid 3 912 BEGIN GTID 0-3-4
|
||||
master-bin.000001 870 Gtid 3 912 BEGIN GTID 0-3-7
|
||||
master-bin.000001 912 Annotate_rows 3 971 INSERT INTO test1.t1 (f1) VALUES (2)
|
||||
master-bin.000001 971 Table_map 3 1020 table_id: ### (test1.t1)
|
||||
master-bin.000001 1020 Write_rows_v1 3 1062 table_id: ### flags: STMT_END_F
|
||||
master-bin.000001 1062 Xid 3 1093 COMMIT /* xid=### */
|
||||
master-bin.000001 1093 Gtid 3 1135 BEGIN GTID 0-3-5
|
||||
master-bin.000001 1093 Gtid 3 1135 BEGIN GTID 0-3-9
|
||||
master-bin.000001 1135 Annotate_rows 3 1194 INSERT INTO test1.t1 (f1) VALUES (3)
|
||||
master-bin.000001 1194 Table_map 3 1243 table_id: ### (test1.t1)
|
||||
master-bin.000001 1243 Write_rows_v1 3 1285 table_id: ### flags: STMT_END_F
|
||||
master-bin.000001 1285 Xid 3 1316 COMMIT /* xid=### */
|
||||
master-bin.000001 1316 Gtid 3 1358 BEGIN GTID 0-3-6
|
||||
master-bin.000001 1316 Gtid 3 1358 BEGIN GTID 0-3-12
|
||||
master-bin.000001 1358 Annotate_rows 3 1451 UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz'
|
||||
master-bin.000001 1451 Table_map 3 1500 table_id: ### (test1.t1)
|
||||
master-bin.000001 1500 Update_rows_v1 3 1588 table_id: ### flags: STMT_END_F
|
||||
master-bin.000001 1588 Xid 3 1619 COMMIT /* xid=### */
|
||||
master-bin.000001 1619 Gtid 3 1661 BEGIN GTID 0-3-7
|
||||
master-bin.000001 1619 Gtid 3 1661 BEGIN GTID 0-3-13
|
||||
master-bin.000001 1661 Annotate_rows 3 1795 DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3
|
||||
master-bin.000001 1795 Table_map 3 1844 table_id: ### (test1.t1)
|
||||
master-bin.000001 1844 Delete_rows_v1 3 1886 table_id: ### flags: STMT_END_F
|
||||
master-bin.000001 1886 Xid 3 1917 COMMIT /* xid=### */
|
||||
master-bin.000001 1917 Gtid 3 1959 BEGIN GTID 0-3-8
|
||||
master-bin.000001 1917 Gtid 3 1959 BEGIN GTID 0-3-15
|
||||
master-bin.000001 1959 Annotate_rows 3 2020 INSERT INTO test1.t1 (f1) VALUES (111)
|
||||
master-bin.000001 2020 Table_map 3 2069 table_id: ### (test1.t1)
|
||||
master-bin.000001 2069 Write_rows_v1 3 2111 table_id: ### flags: STMT_END_F
|
||||
@@ -132,7 +132,7 @@ master-bin.000001 2111 Annotate_rows 3 2172 INSERT INTO test1.t1 (f1) VALUES (22
|
||||
master-bin.000001 2172 Table_map 3 2221 table_id: ### (test1.t1)
|
||||
master-bin.000001 2221 Write_rows_v1 3 2263 table_id: ### flags: STMT_END_F
|
||||
master-bin.000001 2263 Xid 3 2294 COMMIT /* xid=### */
|
||||
master-bin.000001 2294 Gtid 3 2336 BEGIN GTID 0-3-9
|
||||
master-bin.000001 2294 Gtid 3 2336 BEGIN GTID <effective_uuid>
|
||||
master-bin.000001 2336 Annotate_rows 3 2397 INSERT INTO test1.t1 (f1) VALUES (333)
|
||||
master-bin.000001 2397 Table_map 3 2446 table_id: ### (test1.t1)
|
||||
master-bin.000001 2446 Write_rows_v1 3 2488 table_id: ### flags: STMT_END_F
|
||||
@@ -157,3 +157,12 @@ connection node_1;
|
||||
connection node_2;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE ALL;
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
connection node_1;
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
connection node_3;
|
||||
RESET MASTER;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
connection node_1;
|
||||
connection node_2;
|
||||
connection node_2;
|
||||
SET GLOBAL wsrep_ignore_apply_errors=0;
|
||||
SET SESSION wsrep_on=OFF;
|
||||
|
||||
@@ -19,12 +19,12 @@ INSERT INTO t1 VALUES(2);
|
||||
INSERT INTO t1 VALUES(3);
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
0-2-2,2-3-4
|
||||
1-1-2,2-3-4
|
||||
connection node_1;
|
||||
INSERT INTO t1 VALUES(4);
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
1-1-1,2-3-4,2-2-6
|
||||
1-1-3,2-3-4
|
||||
connection node_3;
|
||||
DROP TABLE t1,t2;
|
||||
connection node_2;
|
||||
|
||||
@@ -25,14 +25,14 @@ INSERT INTO t2 VALUES(5,55);
|
||||
INSERT INTO t2 VALUES(6,66);
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
0-2-3,2-3-4
|
||||
1-1-3,2-3-4
|
||||
#Connection 1
|
||||
connection node_1;
|
||||
INSERT INTO t2 VALUES(7,77);
|
||||
INSERT INTO t2 VALUES(8,88);
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
1-1-2,2-3-4,2-2-7
|
||||
1-1-5,2-3-4
|
||||
#Connection 3
|
||||
connection node_3;
|
||||
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
|
||||
@@ -100,12 +100,12 @@ node2_committed_before
|
||||
connection node_1;
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
1-1-3,2-3-6,2-2-9
|
||||
1-1-8,2-3-6
|
||||
#Connection 2
|
||||
connection node_2;
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
0-1-7,0-2-8,2-3-6
|
||||
1-1-8,2-3-6
|
||||
#Connection 3
|
||||
connection node_3;
|
||||
SET AUTOCOMMIT=ON;
|
||||
@@ -134,7 +134,7 @@ count(*)
|
||||
12
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
0-1-7,0-2-11,2-3-7
|
||||
1-1-11,2-3-7
|
||||
#Connection 1
|
||||
connection node_1;
|
||||
SELECT count(*) from t1;
|
||||
@@ -142,7 +142,7 @@ count(*)
|
||||
12
|
||||
SELECT @@global.gtid_binlog_state;
|
||||
@@global.gtid_binlog_state
|
||||
1-1-3,2-3-7,2-2-12
|
||||
1-1-11,2-3-7
|
||||
#Connection 3
|
||||
connection node_3;
|
||||
DROP TABLE t2,t1;
|
||||
|
||||
44
mysql-test/suite/galera/r/galera_gtid_trx_conflict.result
Normal file
44
mysql-test/suite/galera/r/galera_gtid_trx_conflict.result
Normal file
@@ -0,0 +1,44 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
connection node_1;
|
||||
SET AUTOCOMMIT = OFF;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
connection node_2;
|
||||
SET AUTOCOMMIT = OFF;
|
||||
SET @@wsrep_gtid_seq_no = 100;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
connection node_1;
|
||||
COMMIT;
|
||||
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
||||
connection node_2a;
|
||||
connection node_2;
|
||||
COMMIT;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
# Expected GTID value 1-1-2 on both nodes
|
||||
SELECT @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-2
|
||||
SET AUTOCOMMIT = ON;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
# Expected GTID value 1-1-100 on both nodes, seqno is set with wsrep_gtid_seq_no
|
||||
SELECT @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-100
|
||||
connection node_1;
|
||||
SELECT @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-100
|
||||
SET AUTOCOMMIT = ON;
|
||||
INSERT INTO t1 VALUES(3);
|
||||
# Expected GTID value 1-1-101 on both nodes
|
||||
SELECT @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-101
|
||||
connection node_2;
|
||||
SELECT @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-1-101
|
||||
DROP TABLE t1;
|
||||
@@ -1,38 +1,35 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
wsrep_last_committed_id_match
|
||||
1
|
||||
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connection node_1a;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID();
|
||||
WSREP_LAST_WRITTEN_GTID()
|
||||
100-1-0
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection node_1;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;;
|
||||
connection node_1a;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection node_1;
|
||||
wsrep_last_committed_id_match
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() != '100-1-2' AS wsrep_written_does_not_match_different_conn;
|
||||
wsrep_written_does_not_match_different_conn
|
||||
1
|
||||
connection node_2;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() != '100-1-2' AS wsrep_written_does_not_match_different_nodes;
|
||||
wsrep_written_does_not_match_different_nodes
|
||||
1
|
||||
connection node_1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection node_2;
|
||||
wsrep_last_written_seen_id_match
|
||||
1
|
||||
connection node_1;
|
||||
SET AUTOCOMMIT=OFF;
|
||||
START TRANSACTION;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
1
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1'
|
||||
WSREP_LAST_SEEN_GTID() = '100-1-3'
|
||||
1
|
||||
wsrep_last_committed_id_match
|
||||
wsrep_last_written_id_match
|
||||
1
|
||||
COMMIT;
|
||||
wsrep_last_committed_id_advanced
|
||||
1
|
||||
wsrep_last_committed_id_advanced
|
||||
wsrep_last_written_id_advanced
|
||||
1
|
||||
SET AUTOCOMMIT=ON;
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -17,6 +17,7 @@ name wait/synch/mutex/sql/LOCK_wsrep_config_state
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_desync
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_donor_monitor
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_group_commit
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_gtid_wait_upto
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_joiner_monitor
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_ready
|
||||
name wait/synch/mutex/sql/LOCK_wsrep_replaying
|
||||
|
||||
@@ -5,39 +5,22 @@ INSERT INTO t1 VALUES (1);
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(NULL);
|
||||
ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('a');
|
||||
ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
|
||||
ERROR HY000: Could not parse GTID list
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(2);
|
||||
ERROR HY000: Could not parse GTID list
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2');
|
||||
ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
connection node_2;
|
||||
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('100-1-3');
|
||||
connection node_1;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (3);
|
||||
connection node_2;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
||||
connection node_2a;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
connection node_2;
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
WSREP_SYNC_WAIT_UPTO_GTID('100-1-3')
|
||||
1
|
||||
gtid_current = gtid_first
|
||||
1
|
||||
SET GLOBAL DEBUG_DBUG = "";
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
WSREP_SYNC_WAIT_UPTO
|
||||
1
|
||||
seqno_current = seqno_second
|
||||
1
|
||||
SET DEBUG_SYNC = "RESET";
|
||||
connection node_1;
|
||||
DROP TABLE t1;
|
||||
|
||||
14
mysql-test/suite/galera/t/MDEV-10715.cnf
Normal file
14
mysql-test/suite/galera/t/MDEV-10715.cnf
Normal file
@@ -0,0 +1,14 @@
|
||||
!include ../galera_2nodes.cnf
|
||||
|
||||
[mysqld]
|
||||
log-bin=mysqld-bin
|
||||
log-slave-updates
|
||||
binlog-format=ROW
|
||||
[mysqld.1]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=1
|
||||
[mysqld.2]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=1
|
||||
19
mysql-test/suite/galera/t/MDEV-10715.test
Normal file
19
mysql-test/suite/galera/t/MDEV-10715.test
Normal file
@@ -0,0 +1,19 @@
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--connection node_1
|
||||
create table t1(a int);
|
||||
set @@wsrep_gtid_seq_no=22;
|
||||
insert into t1 values(1);
|
||||
insert into t1 values(2);
|
||||
select @@gtid_binlog_state;
|
||||
select wsrep_last_seen_gtid();
|
||||
select wsrep_last_written_gtid();
|
||||
|
||||
--connection node_2
|
||||
select @@gtid_binlog_state;
|
||||
select wsrep_last_seen_gtid();
|
||||
select wsrep_last_written_gtid();
|
||||
|
||||
--connection node_1
|
||||
drop table t1;
|
||||
@@ -15,14 +15,13 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
# Scenario 1: Block INSERT after commit order release after queued for
|
||||
# group commit. Verify that
|
||||
#
|
||||
# - WSREP_LAST_SEEN_GTID is not advanced before commit finishes
|
||||
# - wsrep_last_committed is not advanced before commit finishes
|
||||
# - The INSERT does not become visible before commit finishes
|
||||
|
||||
# Turn off sync wait to avoid blocking and use WSREP_LAST_SEEN_GTID()
|
||||
# Turn off sync wait to avoid blocking and use wsrep_last_committed
|
||||
# to observe gtid position.
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
--let $last_seen_gtid_prev = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
|
||||
--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--connection node_1
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
# Set up sync points
|
||||
@@ -37,7 +36,7 @@ SET DEBUG_SYNC = "after_group_after_commit SIGNAL after_group_reached WAIT_FOR a
|
||||
# committed in memory.
|
||||
SET DEBUG_SYNC = "now WAIT_FOR bcol_reached";
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match
|
||||
--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
SELECT * FROM t1;
|
||||
SET DEBUG_SYNC = "now SIGNAL bcol_continue";
|
||||
@@ -45,14 +44,14 @@ SET DEBUG_SYNC = "now SIGNAL bcol_continue";
|
||||
# SE commit finished but wsrep_after_commit() has not called yet.
|
||||
SET DEBUG_SYNC = "now WAIT_FOR acol_reached";
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match
|
||||
--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
SELECT * FROM t1;
|
||||
SET DEBUG_SYNC = "now SIGNAL acol_continue";
|
||||
|
||||
SET DEBUG_SYNC = "now WAIT_FOR after_group_reached";
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_do_not_match
|
||||
--eval SELECT VARIABLE_VALUE != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_do_not_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
SET DEBUG_SYNC = "now SIGNAL after_group_continue";
|
||||
|
||||
@@ -69,7 +68,7 @@ SET DEBUG_SYNC = "now SIGNAL after_group_continue";
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
|
||||
--connection ctrl
|
||||
--let $last_seen_gtid_prev = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
|
||||
--connection node_1
|
||||
SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_1 WAIT_FOR bcol_continue_1";
|
||||
@@ -80,7 +79,7 @@ SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_1 WAIT_FOR agac_c
|
||||
SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_1";
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match
|
||||
--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
|
||||
--connection node_1a
|
||||
@@ -97,14 +96,14 @@ SET DEBUG_SYNC = "now WAIT_FOR acol_reached_1";
|
||||
SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_2";
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match
|
||||
--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
|
||||
SET DEBUG_SYNC = "now SIGNAL bcol_continue_2";
|
||||
SET DEBUG_SYNC = "now WAIT_FOR acol_reached_2";
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match
|
||||
--eval SELECT VARIABLE_VALUE = '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
|
||||
# Last seen GTIDs are incremented one by one once after_group_after_commit
|
||||
@@ -113,14 +112,14 @@ SET DEBUG_SYNC = "now SIGNAL acol_continue_1";
|
||||
SET DEBUG_SYNC = "now WAIT_FOR agac_reached_1";
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_no_match
|
||||
--eval SELECT VARIABLE_VALUE != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_no_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
|
||||
--let $last_seen_gtid_prev = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--let $last_seen_gtid_prev = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
SET DEBUG_SYNC = "now SIGNAL acol_continue_2";
|
||||
SET DEBUG_SYNC = "now WAIT_FOR agac_reached_2";
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_no_match
|
||||
--eval SELECT VARIABLE_VALUE != '$last_seen_gtid_prev' AS wsrep_last_seen_gtid_no_match FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
|
||||
--enable_query_log
|
||||
|
||||
SET DEBUG_SYNC = "now SIGNAL agac_continue_1";
|
||||
|
||||
@@ -4,3 +4,12 @@
|
||||
log-bin=mysqld-bin
|
||||
log-slave-updates
|
||||
binlog-format=ROW
|
||||
[mysqld.1]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=100
|
||||
[mysqld.2]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
[mysqld.3]
|
||||
gtid-domain-id=2
|
||||
@@ -14,25 +14,22 @@
|
||||
|
||||
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
|
||||
--disable_query_log
|
||||
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
|
||||
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
|
||||
--enable_query_log
|
||||
START SLAVE USER='root';
|
||||
START SLAVE;
|
||||
|
||||
--connection node_1
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--let $effective_uuid = `SELECT LEFT(@@global.gtid_executed, 36)`
|
||||
--disable_query_log
|
||||
--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
|
||||
--enable_query_log
|
||||
SELECT @@global.gtid_binlog_pos;
|
||||
--let $effective_gtid = @@global.gtid_binlog_pos
|
||||
|
||||
--connection node_2
|
||||
INSERT INTO t1 VALUES(2);
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
|
||||
--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match;
|
||||
--eval SELECT '$effective_gtid' != @@global.gtid_binlog_pos AS gtid_do_not_match;
|
||||
--enable_query_log
|
||||
|
||||
--connection node_3
|
||||
@@ -43,8 +40,7 @@ INSERT INTO t1 VALUES(2);
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
|
||||
--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match;
|
||||
--eval SELECT '$effective_gtid' != @@global.gtid_binlog_pos AS gtid_do_not_match;
|
||||
--enable_query_log
|
||||
|
||||
--connection node_1
|
||||
@@ -55,15 +51,14 @@ DROP TABLE t1;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection node_1
|
||||
--let $gtid_executed_node1 = `SELECT @@global.gtid_executed;`
|
||||
|
||||
--let $gtid_executed_node1 = `SELECT @@global.gtid_binlog_pos;`
|
||||
--connection node_2
|
||||
--disable_query_log
|
||||
--eval SELECT '$gtid_executed_node1' = @@global.gtid_executed AS gtid_executed_equal
|
||||
--eval SELECT '$gtid_executed_node1' = @@global.gtid_binlog_pos AS gtid_executed_equal
|
||||
--enable_query_log
|
||||
--connection node_3
|
||||
--disable_query_log
|
||||
--eval SELECT '$gtid_executed_node1' = @@global.gtid_executed AS gtid_executed_equal
|
||||
--eval SELECT '$gtid_executed_node1' = @@global.gtid_binlog_pos AS gtid_executed_equal
|
||||
--enable_query_log
|
||||
|
||||
STOP SLAVE;
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
|
||||
--disable_query_log
|
||||
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
|
||||
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
|
||||
--enable_query_log
|
||||
START SLAVE USER='root';
|
||||
START SLAVE;
|
||||
|
||||
--connection node_1
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
@@ -28,9 +28,9 @@ INSERT INTO t1 VALUES(2);
|
||||
--source include/wait_condition.inc
|
||||
STOP SLAVE;
|
||||
--disable_query_log
|
||||
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_AUTO_POSITION=1;
|
||||
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_USER='root';
|
||||
--enable_query_log
|
||||
START SLAVE USER='root';
|
||||
START SLAVE;
|
||||
|
||||
--connection node_1
|
||||
INSERT INTO t1 VALUES(3);
|
||||
@@ -54,3 +54,14 @@ DROP TABLE t1;
|
||||
|
||||
STOP SLAVE;
|
||||
RESET SLAVE ALL;
|
||||
RESET MASTER;
|
||||
|
||||
--connection node_2
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
|
||||
--connection node_1
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
|
||||
@@ -148,3 +148,14 @@ DROP SCHEMA test2;
|
||||
|
||||
STOP SLAVE;
|
||||
RESET SLAVE ALL;
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
|
||||
--connection node_1
|
||||
SET GLOBAL wsrep_on=OFF;
|
||||
RESET MASTER;
|
||||
SET GLOBAL wsrep_on=ON;
|
||||
|
||||
--connection node_3
|
||||
RESET MASTER;
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# Save original auto_increment_offset values.
|
||||
--let $node_1=node_1
|
||||
--let $node_2=node_2
|
||||
--source include/auto_increment_offset_save.inc
|
||||
|
||||
--connection node_2
|
||||
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
|
||||
let $restore_wsrep_ignore_apply_errors = `SELECT @@GLOBAL.wsrep_ignore_apply_errors`;
|
||||
@@ -39,3 +44,6 @@ CREATE TABLE t1 (f1 INTEGER);
|
||||
DROP TABLE t1;
|
||||
|
||||
CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
|
||||
|
||||
# Restore original auto_increment_offset values.
|
||||
--source include/auto_increment_offset_restore.inc
|
||||
|
||||
@@ -4,15 +4,13 @@
|
||||
log-bin=mysqld-bin
|
||||
log-slave-updates
|
||||
binlog-format=ROW
|
||||
|
||||
[mysqld.1]
|
||||
gtid-domain-id=1
|
||||
[mysqld.2]
|
||||
gtid-domain-id=2
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=2
|
||||
wsrep_gtid_domain_id=1
|
||||
[mysqld.2]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=1
|
||||
[mysqld.3]
|
||||
gtid-domain-id=2
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=2
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ binlog-format=ROW
|
||||
wsrep_sst_method=rsync
|
||||
[mysqld.1]
|
||||
gtid-domain-id=1
|
||||
[mysqld.2]
|
||||
gtid-domain-id=2
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=2
|
||||
wsrep_gtid_domain_id=1
|
||||
[mysqld.2]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=1
|
||||
[mysqld.3]
|
||||
gtid-domain-id=2
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=2
|
||||
|
||||
|
||||
14
mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf
Normal file
14
mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf
Normal file
@@ -0,0 +1,14 @@
|
||||
!include ../galera_2nodes.cnf
|
||||
|
||||
[mysqld]
|
||||
log-bin=mysqld-bin
|
||||
log-slave-updates
|
||||
binlog-format=ROW
|
||||
[mysqld.1]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=1
|
||||
[mysqld.2]
|
||||
gtid-domain-id=1
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=1
|
||||
56
mysql-test/suite/galera/t/galera_gtid_trx_conflict.test
Normal file
56
mysql-test/suite/galera/t/galera_gtid_trx_conflict.test
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Test galera GTID with conflicting trx and @@wsrep_gtid_seq_no set on one node.
|
||||
#
|
||||
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_log_bin.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
|
||||
--connection node_1
|
||||
SET AUTOCOMMIT = OFF;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--connection node_2
|
||||
SET AUTOCOMMIT = OFF;
|
||||
SET @@wsrep_gtid_seq_no = 100;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--connection node_1
|
||||
COMMIT;
|
||||
|
||||
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
||||
--connection node_2a
|
||||
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection node_2
|
||||
--error ER_LOCK_DEADLOCK
|
||||
COMMIT;
|
||||
|
||||
--echo # Expected GTID value 1-1-2 on both nodes
|
||||
SELECT @@gtid_binlog_state;
|
||||
|
||||
SET AUTOCOMMIT = ON;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
|
||||
--echo # Expected GTID value 1-1-100 on both nodes, seqno is set with wsrep_gtid_seq_no
|
||||
SELECT @@gtid_binlog_state;
|
||||
|
||||
--connection node_1
|
||||
SELECT @@gtid_binlog_state;
|
||||
|
||||
SET AUTOCOMMIT = ON;
|
||||
INSERT INTO t1 VALUES(3);
|
||||
|
||||
--echo # Expected GTID value 1-1-101 on both nodes
|
||||
SELECT @@gtid_binlog_state;
|
||||
|
||||
--connection node_2
|
||||
SELECT @@gtid_binlog_state;
|
||||
|
||||
|
||||
DROP TABLE t1;
|
||||
9
mysql-test/suite/galera/t/galera_last_committed_id.cnf
Normal file
9
mysql-test/suite/galera/t/galera_last_committed_id.cnf
Normal file
@@ -0,0 +1,9 @@
|
||||
!include ../galera_2nodes.cnf
|
||||
|
||||
[mysqld.1]
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=100
|
||||
|
||||
[mysqld.2]
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=100
|
||||
@@ -0,0 +1,6 @@
|
||||
[binlogoff]
|
||||
|
||||
[binlogon]
|
||||
--log-bin=master-bin
|
||||
--log-bin-index=master-bin
|
||||
--log-slave-updates
|
||||
@@ -4,64 +4,62 @@
|
||||
|
||||
--source include/galera_cluster.inc
|
||||
|
||||
# Returns -1 if no transactions have been run
|
||||
# Returns domain-server-0 if no transactions have been run
|
||||
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
SELECT WSREP_LAST_WRITTEN_GTID();
|
||||
|
||||
--disable_query_log
|
||||
--let $seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--let $state = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$state:$seqno' AS wsrep_last_committed_id_match;
|
||||
--enable_query_log
|
||||
# WSREP_LAST_WRITTEN_GTID() should not be influenced by transactions written
|
||||
# on other nodes or connections
|
||||
|
||||
# WSREP_LAST_WRITTEN_GTID() should not be influenced by transactions committed
|
||||
# on other connections
|
||||
|
||||
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
|
||||
--connection node_1a
|
||||
--connection node_1
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
--connection node_1
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
|
||||
# WSREP_LAST_SEEN_GTID() should be influenced by transactions committed
|
||||
# on other connections
|
||||
|
||||
--connection node_1a
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--disable_query_log
|
||||
--let $wsrep_last_committed_id_conn_1a = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--let $wsrep_last_written_id_conn_1 = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
--enable_query_log
|
||||
|
||||
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
--connection node_1a
|
||||
--eval SELECT WSREP_LAST_WRITTEN_GTID() != '$wsrep_last_written_id_conn_1' AS wsrep_written_does_not_match_different_conn
|
||||
|
||||
--connection node_2
|
||||
--eval SELECT WSREP_LAST_WRITTEN_GTID() != '$wsrep_last_written_id_conn_1' AS wsrep_written_does_not_match_different_nodes
|
||||
|
||||
# WSREP_LAST_SEEN_GTID() should be influenced by transactions written
|
||||
# on other connections
|
||||
|
||||
--connection node_1
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_committed_id_conn_1a' AS wsrep_last_committed_id_match;
|
||||
--let $wsrep_last_written_id_conn_1 = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
--enable_query_log
|
||||
|
||||
--connection node_2
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_written_id_conn_1' AS wsrep_last_written_seen_id_match
|
||||
--enable_query_log
|
||||
|
||||
# Should not advance while a transaction is in progress
|
||||
|
||||
--connection node_1
|
||||
SET AUTOCOMMIT=OFF;
|
||||
START TRANSACTION;
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
|
||||
--disable_query_log
|
||||
--let $wsrep_last_committed_id_before = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--let $wsrep_last_written_id_before = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
--enable_query_log
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT WSREP_LAST_WRITTEN_GTID() = '00000000-0000-0000-0000-000000000000:-1';
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_committed_id_before' AS wsrep_last_committed_id_match;
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$wsrep_last_written_id_before'
|
||||
--eval SELECT WSREP_LAST_WRITTEN_GTID() = '$wsrep_last_written_id_before' AS wsrep_last_written_id_match
|
||||
--enable_query_log
|
||||
|
||||
# Should only advance after the transaction has been committed
|
||||
# Should only advance after the transaction has been commited
|
||||
|
||||
COMMIT;
|
||||
--disable_query_log
|
||||
--let $seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--let $state = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
|
||||
--eval SELECT WSREP_LAST_WRITTEN_GTID() = '$state:$seqno' AS wsrep_last_committed_id_advanced;
|
||||
--eval SELECT WSREP_LAST_SEEN_GTID() = '$state:$seqno' AS wsrep_last_committed_id_advanced;
|
||||
--eval SELECT WSREP_LAST_WRITTEN_GTID() != 'wsrep_last_written_id_before' AS wsrep_last_written_id_advanced
|
||||
--enable_query_log
|
||||
SET AUTOCOMMIT=ON;
|
||||
|
||||
|
||||
9
mysql-test/suite/galera/t/galera_sync_wait_upto.cnf
Normal file
9
mysql-test/suite/galera/t/galera_sync_wait_upto.cnf
Normal file
@@ -0,0 +1,9 @@
|
||||
!include ../galera_2nodes.cnf
|
||||
|
||||
[mysqld.1]
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=100
|
||||
|
||||
[mysqld.2]
|
||||
wsrep_gtid_mode=1
|
||||
wsrep_gtid_domain_id=100
|
||||
@@ -0,0 +1,6 @@
|
||||
[binlogoff]
|
||||
|
||||
[binlogon]
|
||||
--log-bin=master-bin
|
||||
--log-bin-index=master-bin
|
||||
--log-slave-updates
|
||||
@@ -8,108 +8,64 @@
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
|
||||
# Test with invalid values
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(NULL);
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
--error ER_INCORRECT_GTID_STATE
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('a');
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
--error ER_INCORRECT_GTID_STATE
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID(2);
|
||||
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2');
|
||||
|
||||
# Expected starting seqno
|
||||
|
||||
--let $start_seqno = 2
|
||||
|
||||
# If set to low value, expect no waiting
|
||||
|
||||
--disable_query_log
|
||||
--let $seqno = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
|
||||
--let $state = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
|
||||
--let $lower_seqno = $start_seqno
|
||||
--dec $lower_seqno
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('100-1-$lower_seqno') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('00000000-0000-0000-0000-000000000000:-1') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
# If set to current last_committed value no waiting
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$state:0') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--let $wsrep_last_committed_gtid = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$wsrep_last_committed_gtid') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# If set to current last_committed value
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$state:$seqno') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# If set to very high value, will wait
|
||||
# Timeout if GTID is not received on time
|
||||
|
||||
--disable_query_log
|
||||
--let $high_seqno = $start_seqno
|
||||
--inc $high_seqno
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$state:9223372036854775807', 1) AS WSREP_SYNC_WAIT_UPTO;
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('100-1-$high_seqno', 1) AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# If applier is blocked, will wait
|
||||
# Wait for GTID value
|
||||
|
||||
--connection node_2
|
||||
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
|
||||
--disable_query_log
|
||||
--let $wait_seqno = $start_seqno
|
||||
--inc $wait_seqno
|
||||
--enable_query_log
|
||||
|
||||
--send_eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('100-1-$wait_seqno')
|
||||
|
||||
--connection node_1
|
||||
# Perform two inserts and record the IDs of each
|
||||
INSERT INTO t1 VALUES (2);
|
||||
--let $gtid_first = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
|
||||
INSERT INTO t1 VALUES (3);
|
||||
--let $gtid_second = `SELECT WSREP_LAST_WRITTEN_GTID()`
|
||||
|
||||
--connection node_2
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
|
||||
--disable_query_log
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$gtid_first', 1) AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--send_eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$gtid_first') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
# Unblock applier
|
||||
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
||||
--connection node_2a
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE 'SELECT WSREP_SYNC_WAIT%';
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
|
||||
--connection node_2
|
||||
--reap
|
||||
|
||||
# Confirm that we were allowed to proceed when the applier reached $seqno_first
|
||||
--let $gtid_current = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--disable_query_log
|
||||
--eval SELECT '$gtid_current' = '$gtid_first' AS `gtid_current = gtid_first`
|
||||
--enable_query_log
|
||||
|
||||
SET GLOBAL DEBUG_DBUG = "";
|
||||
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
|
||||
|
||||
# Move forward some more, to $seqno_second;
|
||||
|
||||
--disable_query_log
|
||||
--eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$gtid_second') AS WSREP_SYNC_WAIT_UPTO;
|
||||
--enable_query_log
|
||||
|
||||
--let $gtid_current = `SELECT WSREP_LAST_SEEN_GTID()`
|
||||
--disable_query_log
|
||||
--eval SELECT '$gtid_current' = '$gtid_second' AS `seqno_current = seqno_second`
|
||||
--enable_query_log
|
||||
|
||||
SET DEBUG_SYNC = "RESET";
|
||||
|
||||
--connection node_1
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -92,7 +92,7 @@ select @@gtid_binlog_state;
|
||||
insert into t1 values (1, 12, 3);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2,1-12-3,2-21-1
|
||||
1-11-3,2-21-1
|
||||
#wait for sync cluster 1 and 2
|
||||
connection node_1;
|
||||
include/save_master_gtid.inc
|
||||
@@ -102,11 +102,11 @@ cluster 1 node 3
|
||||
connection node_3;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2,1-12-3,2-21-1
|
||||
1-11-3,2-21-1
|
||||
insert into t1 values (1, 13, 4);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1
|
||||
1-11-4,2-21-1
|
||||
#wait for sync cluster 1 and 2
|
||||
connection node_1;
|
||||
include/save_master_gtid.inc
|
||||
@@ -116,11 +116,11 @@ cluster 2 node 2
|
||||
connection node_5;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1
|
||||
1-11-4,2-21-1
|
||||
insert into t1 values (2, 22, 2);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
|
||||
1-11-4,2-21-2
|
||||
#wait for sync cluster 2 and 1
|
||||
connection node_4;
|
||||
include/save_master_gtid.inc
|
||||
@@ -130,11 +130,11 @@ cluster 2 node 3
|
||||
connection node_6;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
|
||||
1-11-4,2-21-2
|
||||
insert into t1 values (2, 23, 3);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
|
||||
1-11-4,2-21-3
|
||||
#wait for sync cluster 2 and 1
|
||||
connection node_4;
|
||||
include/save_master_gtid.inc
|
||||
@@ -144,7 +144,7 @@ cluster 1 node 1
|
||||
connection node_1;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
|
||||
1-11-4,2-21-3
|
||||
drop table t1;
|
||||
stop slave;
|
||||
reset slave;
|
||||
@@ -208,7 +208,7 @@ create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
|
||||
insert into t1 values (1, 11, 2);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2
|
||||
1-11-7
|
||||
#wait for sync cluster 1 and 2
|
||||
connection node_1;
|
||||
include/save_master_gtid.inc
|
||||
@@ -219,7 +219,7 @@ connection node_4;
|
||||
insert into t1 values (2, 21, 1);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2,2-21-1
|
||||
1-11-7,2-21-4
|
||||
select * from t1;
|
||||
cluster_domain_id node_server_id seq_no
|
||||
1 11 2
|
||||
@@ -233,11 +233,11 @@ cluster 1 node 2
|
||||
connection node_2;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2,2-21-1
|
||||
1-11-7,2-21-4
|
||||
insert into t1 values (1, 12, 3);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2,1-12-3,2-21-1
|
||||
1-11-8,2-21-4
|
||||
#wait for sync cluster 1 and 2
|
||||
connection node_1;
|
||||
include/save_master_gtid.inc
|
||||
@@ -247,11 +247,11 @@ cluster 1 node 3
|
||||
connection node_3;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-11-2,1-12-3,2-21-1
|
||||
1-11-8,2-21-4
|
||||
insert into t1 values (1, 13, 4);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1
|
||||
1-11-9,2-21-4
|
||||
#wait for sync cluster 1 and 2
|
||||
connection node_1;
|
||||
include/save_master_gtid.inc
|
||||
@@ -261,11 +261,11 @@ cluster 2 node 2
|
||||
connection node_5;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1
|
||||
1-11-9,2-21-4
|
||||
insert into t1 values (2, 22, 2);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
|
||||
1-11-9,2-21-5
|
||||
#wait for sync cluster 2 and 1
|
||||
connection node_4;
|
||||
include/save_master_gtid.inc
|
||||
@@ -275,11 +275,11 @@ cluster 2 node 3
|
||||
connection node_6;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
|
||||
1-11-9,2-21-5
|
||||
insert into t1 values (2, 23, 3);
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
|
||||
1-11-9,2-21-6
|
||||
#wait for sync cluster 2 and 1
|
||||
connection node_4;
|
||||
include/save_master_gtid.inc
|
||||
@@ -289,7 +289,7 @@ cluster 1 node 1
|
||||
connection node_1;
|
||||
select @@gtid_binlog_state;
|
||||
@@gtid_binlog_state
|
||||
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
|
||||
1-11-9,2-21-6
|
||||
drop table t1;
|
||||
stop slave;
|
||||
change master to master_use_gtid=no, ignore_server_ids=();
|
||||
|
||||
@@ -241,6 +241,21 @@ ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
GLOBAL_VALUE_PATH NULL
|
||||
VARIABLE_NAME WSREP_GTID_SEQ_NO
|
||||
SESSION_VALUE 0
|
||||
GLOBAL_VALUE NULL
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE 0
|
||||
VARIABLE_SCOPE SESSION ONLY
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
VARIABLE_COMMENT Internal server usage, manually set WSREP GTID seqno.
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MAX_VALUE 18446744073709551615
|
||||
NUMERIC_BLOCK_SIZE 1
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT NULL
|
||||
GLOBAL_VALUE_PATH NULL
|
||||
VARIABLE_NAME WSREP_IGNORE_APPLY_ERRORS
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE 7
|
||||
|
||||
Reference in New Issue
Block a user