--source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc --disable_ps2_protocol # # We create InnoDB seqeuence with small cache that is then # used as default value for column in table. # --connection node_1 --let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1, 0), (3, 0); --connection node_1 START TRANSACTION; INSERT INTO t1 VALUES (4, next value for s); # No conflict in cert INSERT INTO t1 VALUES (5, next value for s); # No conflict in cert INSERT INTO t1 VALUES (6, next value for s); # No conflict in cert INSERT INTO t1 VALUES (7, next value for s); # No conflict in cert INSERT INTO t1 VALUES (8, next value for s); # No conflict in cert INSERT INTO t1 VALUES (9, next value for s); # No conflict in cert INSERT INTO t1 VALUES (10, next value for s); # No conflict in cert INSERT INTO t1 VALUES (11, next value for s); # No conflict in cert INSERT INTO t1 VALUES (12, next value for s); # No conflict in cert INSERT INTO t1 VALUES (13, next value for s); # No conflict in cert INSERT INTO t1 VALUES (14, next value for s); # No conflict in cert SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE; # Should cause GAP lock between 1 and 3 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 SET SESSION wsrep_sync_wait=0; # Block the applier on node #1 and issue a conflicting update on node #2 --let $galera_sync_point = apply_monitor_slave_enter_sync --source include/galera_set_sync_point.inc # # Send conflicting INSERT # --connection node_2 INSERT INTO t1 VALUES (2, 2); # This should BF abort because of GAP lock --connection node_1a --source include/galera_wait_sync_point.inc --source include/galera_clear_sync_point.inc # Block the commit, send the COMMIT and wait until it gets blocked --let $galera_sync_point = commit_monitor_master_enter_sync --source include/galera_set_sync_point.inc --connection node_1 --send COMMIT --connection node_1a --let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync --source include/galera_wait_sync_point.inc --source include/galera_clear_sync_point.inc --let $galera_sync_point = abort_trx_end --source include/galera_set_sync_point.inc --let $galera_sync_point = apply_monitor_slave_enter_sync --source include/galera_signal_sync_point.inc --let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync --source include/galera_wait_sync_point.inc # Let the transactions proceed --source include/galera_clear_sync_point.inc --let $galera_sync_point = abort_trx_end --source include/galera_signal_sync_point.inc --let $galera_sync_point = commit_monitor_master_enter_sync --source include/galera_signal_sync_point.inc # Commit succeeds --connection node_1 --reap # wsrep_local_replays has increased by 1 --let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` --disable_query_log --eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; --enable_query_log INSERT INTO t1 VALUES (22, next value for s); INSERT INTO t1 VALUES (23, next value for s); INSERT INTO t1 VALUES (24, next value for s); INSERT INTO t1 VALUES (25, next value for s); INSERT INTO t1 VALUES (26, next value for s); INSERT INTO t1 VALUES (27, next value for s); INSERT INTO t1 VALUES (28, next value for s); INSERT INTO t1 VALUES (29, next value for s); INSERT INTO t1 VALUES (30, next value for s); INSERT INTO t1 VALUES (31, next value for s); INSERT INTO t1 VALUES (32, next value for s); INSERT INTO t1 VALUES (33, next value for s); INSERT INTO t1 VALUES (34, next value for s); INSERT INTO t1 VALUES (35, next value for s); --connection node_1 SELECT * FROM t1; SELECT LASTVAL(s); --connection node_2 SELECT * FROM t1; SELECT LASTVAL(s); --connection node_1 SELECT NEXTVAL(s); --connection node_2 SELECT NEXTVAL(s); DROP SEQUENCE s; DROP TABLE t1;