mariadb/mysql-test/suite/galera/t/galera_last_committed_id.test
2024-11-06 04:59:10 +01:00

69 lines
2.1 KiB
Text

#
# Tests functions WSREP_LAST_WRITTEN_GTID and WSREP_LAST_SEEN_GTID
#
--source include/galera_cluster.inc
# Returns domain-server-0 if no transactions have been run
SELECT WSREP_LAST_WRITTEN_GTID();
# WSREP_LAST_WRITTEN_GTID() should not be influenced by transactions written
# on other nodes or connections
--connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--disable_query_log
--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
--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;
--disable_query_log
--let $wsrep_last_written_id_before = `SELECT WSREP_LAST_WRITTEN_GTID()`
--enable_query_log
INSERT INTO t1 VALUES (1);
--disable_query_log
--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 commited
COMMIT;
--disable_query_log
--eval SELECT WSREP_LAST_WRITTEN_GTID() != 'wsrep_last_written_id_before' AS wsrep_last_written_id_advanced
--enable_query_log
SET AUTOCOMMIT=ON;
DROP TABLE t1;
--connection node_2
CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");