| 1 |
# |
| 2 |
# Bug #21025880 DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN) |
| 3 |
# |
| 4 |
CREATE TABLE t1 ( |
| 5 |
a INT NOT NULL, |
| 6 |
b INT NOT NULL, |
| 7 |
PRIMARY KEY(b), |
| 8 |
UNIQUE KEY(a)) |
| 9 |
ENGINE=INNODB; |
| 10 |
SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc; |
| 11 |
SET GLOBAL innodb_stats_auto_recalc = OFF; |
| 12 |
connect purge_control,localhost,root; |
| 13 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 14 |
connection default; |
| 15 |
SET @old_tx_isolation = @@transaction_isolation; |
| 16 |
SET GLOBAL transaction_isolation = 'READ-COMMITTED'; |
| 17 |
SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout; |
| 18 |
SET GLOBAL innodb_lock_wait_timeout = 1; |
| 19 |
connect con1,localhost,root,,; |
| 20 |
INSERT INTO t1 VALUES (1,1),(2,2); |
| 21 |
DELETE FROM t1; |
| 22 |
SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL |
| 23 |
con1_locks_done WAIT_FOR con1_go'; |
| 24 |
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL |
| 25 |
con1_insert_done WAIT_FOR con1_finish'; |
| 26 |
REPLACE INTO t1 VALUES (1,2); |
| 27 |
connect con2,localhost,root,,; |
| 28 |
SET debug_sync = 'now WAIT_FOR con1_locks_done'; |
| 29 |
SET debug_sync = 'lock_wait_start SIGNAL con2_blocked |
| 30 |
WAIT_FOR con2_go'; |
| 31 |
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock |
| 32 |
WAIT_FOR con2_finish'; |
| 33 |
SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done'; |
| 34 |
REPLACE INTO t1 VALUES (1,3); |
| 35 |
connection default; |
| 36 |
SET debug_sync = 'now WAIT_FOR con2_blocked'; |
| 37 |
connection purge_control; |
| 38 |
COMMIT; |
| 39 |
disconnect purge_control; |
| 40 |
connection default; |
| 41 |
InnoDB 0 transactions not purged |
| 42 |
SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done'; |
| 43 |
SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done'; |
| 44 |
SET debug_sync = 'now SIGNAL con1_finish'; |
| 45 |
connection con1; |
| 46 |
disconnect con1; |
| 47 |
connection default; |
| 48 |
SET debug_sync = 'now SIGNAL con2_finish'; |
| 49 |
connection con2; |
| 50 |
disconnect con2; |
| 51 |
connection default; |
| 52 |
SET DEBUG_SYNC= 'RESET'; |
| 53 |
SELECT * FROM t1; |
| 54 |
a b |
| 55 |
1 2 |
| 56 |
CHECK TABLE t1; |
| 57 |
Table Op Msg_type Msg_text |
| 58 |
test.t1 check status OK |
| 59 |
DROP TABLE t1; |
| 60 |
SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc; |
| 61 |
SET GLOBAL transaction_isolation = @old_tx_isolation; |
| 62 |
SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout; |
| 63 |
CREATE TABLE t1 ( |
| 64 |
a INT NOT NULL, |
| 65 |
b INT NOT NULL, |
| 66 |
PRIMARY KEY(b), |
| 67 |
UNIQUE KEY(a)) |
| 68 |
ENGINE=INNODB; |
| 69 |
SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc; |
| 70 |
SET GLOBAL innodb_stats_auto_recalc = OFF; |
| 71 |
connect purge_control,localhost,root; |
| 72 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 73 |
connection default; |
| 74 |
SET @old_tx_isolation = @@transaction_isolation; |
| 75 |
SET GLOBAL transaction_isolation = 'READ-COMMITTED'; |
| 76 |
SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout; |
| 77 |
SET GLOBAL innodb_lock_wait_timeout = 1; |
| 78 |
connect con1,localhost,root,,; |
| 79 |
INSERT INTO t1 VALUES (1,1),(2,2); |
| 80 |
DELETE FROM t1; |
| 81 |
SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL |
| 82 |
con1_locks_done WAIT_FOR con1_go'; |
| 83 |
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL |
| 84 |
con1_insert_done WAIT_FOR con1_finish'; |
| 85 |
INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2; |
| 86 |
connect con2,localhost,root,,; |
| 87 |
SET debug_sync = 'now WAIT_FOR con1_locks_done'; |
| 88 |
SET debug_sync = 'lock_wait_start SIGNAL con2_blocked |
| 89 |
WAIT_FOR con2_go'; |
| 90 |
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock |
| 91 |
WAIT_FOR con2_finish'; |
| 92 |
SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done'; |
| 93 |
REPLACE INTO t1 VALUES (1,3); |
| 94 |
connection default; |
| 95 |
SET debug_sync = 'now WAIT_FOR con2_blocked'; |
| 96 |
connection purge_control; |
| 97 |
COMMIT; |
| 98 |
disconnect purge_control; |
| 99 |
connection default; |
| 100 |
InnoDB 0 transactions not purged |
| 101 |
SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done'; |
| 102 |
SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done'; |
| 103 |
SET debug_sync = 'now SIGNAL con1_finish'; |
| 104 |
connection con1; |
| 105 |
disconnect con1; |
| 106 |
connection default; |
| 107 |
SET debug_sync = 'now SIGNAL con2_finish'; |
| 108 |
connection con2; |
| 109 |
disconnect con2; |
| 110 |
connection default; |
| 111 |
SET DEBUG_SYNC= 'RESET'; |
| 112 |
SELECT * FROM t1; |
| 113 |
a b |
| 114 |
1 2 |
| 115 |
CHECK TABLE t1; |
| 116 |
Table Op Msg_type Msg_text |
| 117 |
test.t1 check status OK |
| 118 |
DROP TABLE t1; |
| 119 |
SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc; |
| 120 |
SET GLOBAL transaction_isolation = @old_tx_isolation; |
| 121 |
SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout; |