Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-27806 GTIDs diverge in Galera cluster after CTAS
Add OPTION_GTID_BEGIN to applying side thread. This is needed to avoid intermediate commits when CREATE TABLE AS SELECT is applied, causing one more GTID to be consumed with respect to executing node. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
- Loading branch information
Showing
7 changed files
with
120 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
connection node_2; | ||
connection node_1; | ||
connection node_1; | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); | ||
INSERT INTO t1 VALUES (1),(2),(3); | ||
CREATE TABLE ts1 AS SELECT * FROM t1; | ||
include/show_binlog_events.inc | ||
Log_name Pos Event_type Server_id End_log_pos Info | ||
mysqld-bin.000002 # Gtid # # BEGIN GTID #-#-# | ||
mysqld-bin.000002 # Query # # use `test`; CREATE TABLE `ts1` ( | ||
`f1` int(11) NOT NULL | ||
) | ||
mysqld-bin.000002 # Annotate_rows # # CREATE TABLE ts1 AS SELECT * FROM t1 | ||
mysqld-bin.000002 # Table_map # # table_id: # (test.ts1) | ||
mysqld-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F | ||
mysqld-bin.000002 # Xid # # COMMIT /* XID */ | ||
connection node_2; | ||
include/show_binlog_events.inc | ||
Log_name Pos Event_type Server_id End_log_pos Info | ||
mysqld-bin.000003 # Gtid # # BEGIN GTID #-#-# | ||
mysqld-bin.000003 # Query # # use `test`; CREATE TABLE `ts1` ( | ||
`f1` int(11) NOT NULL | ||
) | ||
mysqld-bin.000003 # Annotate_rows # # CREATE TABLE ts1 AS SELECT * FROM t1 | ||
mysqld-bin.000003 # Table_map # # table_id: # (test.ts1) | ||
mysqld-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F | ||
mysqld-bin.000003 # Xid # # COMMIT /* XID */ | ||
BINLOG_POSITIONS_MATCH | ||
1 | ||
DROP TABLE t1,ts1; | ||
connection node_1; | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); | ||
CREATE TABLE ts1 AS SELECT * FROM t1; | ||
include/show_binlog_events.inc | ||
Log_name Pos Event_type Server_id End_log_pos Info | ||
mysqld-bin.000002 # Gtid # # BEGIN GTID #-#-# | ||
mysqld-bin.000002 # Query # # use `test`; CREATE TABLE `ts1` ( | ||
`f1` int(11) NOT NULL | ||
) | ||
mysqld-bin.000002 # Xid # # COMMIT /* XID */ | ||
connection node_2; | ||
include/show_binlog_events.inc | ||
Log_name Pos Event_type Server_id End_log_pos Info | ||
mysqld-bin.000003 # Gtid # # BEGIN GTID #-#-# | ||
mysqld-bin.000003 # Query # # use `test`; CREATE TABLE `ts1` ( | ||
`f1` int(11) NOT NULL | ||
) | ||
mysqld-bin.000003 # Query # # COMMIT | ||
BINLOG_POSITIONS_MATCH | ||
1 | ||
DROP TABLE t1,ts1; | ||
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); |
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 @@ | ||
--log-bin --log-slave-updates --gtid-strict-mode --wsrep_gtid_mode=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# | ||
# MDEV-27806 GTIDs diverge after CTAS | ||
# | ||
--source include/galera_cluster.inc | ||
|
||
--connection node_1 | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); | ||
INSERT INTO t1 VALUES (1),(2),(3); | ||
CREATE TABLE ts1 AS SELECT * FROM t1; | ||
--let binlog_pos= `SELECT @@gtid_binlog_pos` | ||
|
||
--let $MASTER_MYPORT=$NODE_MYPORT_1 | ||
--let $binlog_file=LAST | ||
--let $binlog_limit=8,20 | ||
--source include/show_binlog_events.inc | ||
|
||
--connection node_2 | ||
--let $binlog_limit=7,20 | ||
--source include/show_binlog_events.inc | ||
|
||
--disable_query_log | ||
--eval SELECT STRCMP(@@gtid_binlog_pos, "$binlog_pos") = 0 AS BINLOG_POSITIONS_MATCH; | ||
--enable_query_log | ||
|
||
DROP TABLE t1,ts1; | ||
|
||
|
||
# | ||
# Same as above, with empty CREATE TABLE AS SELECT | ||
# | ||
--connection node_1 | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); | ||
CREATE TABLE ts1 AS SELECT * FROM t1; | ||
--let binlog_pos= `SELECT @@gtid_binlog_pos` | ||
|
||
--let $MASTER_MYPORT=$NODE_MYPORT_1 | ||
--let $binlog_file=LAST | ||
--let $binlog_limit=18,20 | ||
--source include/show_binlog_events.inc | ||
|
||
--connection node_2 | ||
--let $binlog_limit=17,20 | ||
--source include/show_binlog_events.inc | ||
|
||
--disable_query_log | ||
--eval SELECT STRCMP(@@gtid_binlog_pos, "$binlog_pos") = 0 AS BINLOG_POSITIONS_MATCH; | ||
--enable_query_log | ||
|
||
DROP TABLE t1,ts1; | ||
|
||
CALL mtr.add_suppression("Ignoring server id for non bootstrap node"); |
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