| 1 |
# |
| 2 |
# Test that the wsrep_retry_autocommit variable is respected. |
| 3 |
# |
| 4 |
|
| 5 |
--source include/galera_cluster.inc |
| 6 |
--source include/have_innodb.inc |
| 7 |
--source include/have_debug.inc |
| 8 |
--source include/have_debug_sync.inc |
| 9 |
--source include/galera_have_debug_sync.inc |
| 10 |
|
| 11 |
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 12 |
|
| 13 |
# |
| 14 |
# With wsrep_retry_autocommit = 0, error is certain |
| 15 |
# |
| 16 |
|
| 17 |
--connection node_1 |
| 18 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 19 |
|
| 20 |
SET SESSION wsrep_retry_autocommit = 0; |
| 21 |
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; |
| 22 |
--send INSERT INTO t1 (f1) VALUES (2) |
| 23 |
|
| 24 |
--connection node_1a |
| 25 |
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; |
| 26 |
|
| 27 |
--connection node_2 |
| 28 |
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' |
| 29 |
--source include/wait_condition.inc |
| 30 |
TRUNCATE TABLE t1; |
| 31 |
|
| 32 |
--connection node_1 |
| 33 |
--error ER_LOCK_DEADLOCK |
| 34 |
--reap |
| 35 |
SELECT COUNT(*) FROM t1; |
| 36 |
|
| 37 |
SET DEBUG_SYNC = 'RESET'; |
| 38 |
DROP TABLE t1; |
| 39 |
|
| 40 |
|
| 41 |
# |
| 42 |
# With wsrep_retry_autocommit = 1, success against one TRUNCATE |
| 43 |
# |
| 44 |
|
| 45 |
--connection node_1 |
| 46 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 47 |
|
| 48 |
SET SESSION wsrep_retry_autocommit = 1; |
| 49 |
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; |
| 50 |
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; |
| 51 |
--send INSERT INTO t1 (f1) VALUES (3) |
| 52 |
|
| 53 |
--connection node_1a |
| 54 |
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; |
| 55 |
|
| 56 |
--connection node_2 |
| 57 |
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' |
| 58 |
--source include/wait_condition.inc |
| 59 |
TRUNCATE TABLE t1; |
| 60 |
|
| 61 |
--connection node_1a |
| 62 |
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; |
| 63 |
SELECT COUNT(*) FROM t1; |
| 64 |
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; |
| 65 |
|
| 66 |
--connection node_1 |
| 67 |
--error 0,ER_LOCK_DEADLOCK |
| 68 |
--reap |
| 69 |
SELECT COUNT(*) FROM t1; |
| 70 |
|
| 71 |
SET DEBUG_SYNC = 'RESET'; |
| 72 |
SET GLOBAL debug_dbug = NULL; |
| 73 |
DROP TABLE t1; |
| 74 |
|
| 75 |
|
| 76 |
# |
| 77 |
# With wsrep_retry_autcommit = 1, failure against multiple TRUNCATEs |
| 78 |
# |
| 79 |
|
| 80 |
--connection node_1 |
| 81 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 82 |
|
| 83 |
SET SESSION wsrep_retry_autocommit = 1; |
| 84 |
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; |
| 85 |
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 2'; |
| 86 |
|
| 87 |
--send INSERT INTO t1 VALUES (4); |
| 88 |
|
| 89 |
--connection node_1a |
| 90 |
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; |
| 91 |
|
| 92 |
--connection node_2 |
| 93 |
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' |
| 94 |
--source include/wait_condition.inc |
| 95 |
TRUNCATE TABLE t1; |
| 96 |
|
| 97 |
--connection node_1a |
| 98 |
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; |
| 99 |
SELECT COUNT(*) FROM t1; |
| 100 |
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert'; |
| 101 |
|
| 102 |
--connection node_2 |
| 103 |
TRUNCATE TABLE t1; |
| 104 |
|
| 105 |
--connection node_1a |
| 106 |
SELECT COUNT(*) FROM t1; |
| 107 |
|
| 108 |
--connection node_1 |
| 109 |
--error 0,ER_LOCK_DEADLOCK |
| 110 |
--reap |
| 111 |
|
| 112 |
SET DEBUG_SYNC = 'RESET'; |
| 113 |
SET GLOBAL debug_dbug = NULL; |
| 114 |
DROP TABLE t1; |
| 115 |
|
| 116 |
|
| 117 |
# |
| 118 |
# With wsrep_retry_autocommit = 64, success against 64 TRUNCATEs |
| 119 |
# |
| 120 |
|
| 121 |
--connection node_1 |
| 122 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 123 |
|
| 124 |
SET SESSION wsrep_retry_autocommit = 64; |
| 125 |
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; |
| 126 |
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64'; |
| 127 |
|
| 128 |
--send INSERT INTO t1 VALUES (5) |
| 129 |
|
| 130 |
--connection node_2 |
| 131 |
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' |
| 132 |
--source include/wait_condition.inc |
| 133 |
|
| 134 |
--connection node_1 |
| 135 |
--disable_query_log |
| 136 |
--disable_result_log |
| 137 |
--let $count = 64 |
| 138 |
while ($count) |
| 139 |
{ |
| 140 |
--connection node_1a |
| 141 |
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; |
| 142 |
|
| 143 |
--connection node_2 |
| 144 |
TRUNCATE TABLE t1; |
| 145 |
|
| 146 |
--connection node_1a |
| 147 |
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; |
| 148 |
SELECT COUNT(*) FROM t1; |
| 149 |
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; |
| 150 |
|
| 151 |
--dec $count |
| 152 |
} |
| 153 |
--enable_result_log |
| 154 |
--enable_query_log |
| 155 |
|
| 156 |
--connection node_1 |
| 157 |
--error 0,ER_LOCK_DEADLOCK |
| 158 |
--reap |
| 159 |
SELECT COUNT(*) FROM t1; |
| 160 |
|
| 161 |
SET DEBUG_SYNC = 'RESET'; |
| 162 |
SET GLOBAL debug_dbug = NULL; |
| 163 |
DROP TABLE t1; |