Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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.
- Loading branch information
mkaruza
authored and
Jan Lindström
committed
Jan 29, 2020
1 parent
5defdc3
commit 41bc736
Showing
52 changed files
with
1,053 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
| 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; | ||
| wsrep_last_committed_id_match | ||
| 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.