| 1 |
--echo # |
| 2 |
--echo # Bug #21025880 DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN) |
| 3 |
--echo # |
| 4 |
|
| 5 |
--source include/have_innodb.inc |
| 6 |
--source include/have_debug.inc |
| 7 |
--source include/have_debug_sync.inc |
| 8 |
|
| 9 |
let $i=0; |
| 10 |
|
| 11 |
while ($i <=1 ) |
| 12 |
{ |
| 13 |
|
| 14 |
CREATE TABLE t1 ( |
| 15 |
a INT NOT NULL, |
| 16 |
b INT NOT NULL, |
| 17 |
PRIMARY KEY(b), |
| 18 |
UNIQUE KEY(a)) |
| 19 |
ENGINE=INNODB; |
| 20 |
|
| 21 |
SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc; |
| 22 |
SET GLOBAL innodb_stats_auto_recalc = OFF; |
| 23 |
|
| 24 |
# Block purge |
| 25 |
connect purge_control,localhost,root; |
| 26 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 27 |
connection default; |
| 28 |
|
| 29 |
SET @old_tx_isolation = @@transaction_isolation; |
| 30 |
SET GLOBAL transaction_isolation = 'READ-COMMITTED'; |
| 31 |
|
| 32 |
SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout; |
| 33 |
SET GLOBAL innodb_lock_wait_timeout = 1; |
| 34 |
|
| 35 |
--connect(con1,localhost,root,,) |
| 36 |
|
| 37 |
# Create and delete-mark an index record |
| 38 |
|
| 39 |
INSERT INTO t1 VALUES (1,1),(2,2); |
| 40 |
DELETE FROM t1; |
| 41 |
|
| 42 |
SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL |
| 43 |
con1_locks_done WAIT_FOR con1_go'; |
| 44 |
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL |
| 45 |
con1_insert_done WAIT_FOR con1_finish'; |
| 46 |
--send |
| 47 |
|
| 48 |
if ($i == 0) |
| 49 |
{ |
| 50 |
REPLACE INTO t1 VALUES (1,2); |
| 51 |
} |
| 52 |
|
| 53 |
if ( $i == 1) |
| 54 |
{ |
| 55 |
INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2; |
| 56 |
} |
| 57 |
--connect(con2,localhost,root,,) |
| 58 |
|
| 59 |
SET debug_sync = 'now WAIT_FOR con1_locks_done'; |
| 60 |
|
| 61 |
SET debug_sync = 'lock_wait_start SIGNAL con2_blocked |
| 62 |
WAIT_FOR con2_go'; |
| 63 |
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock |
| 64 |
WAIT_FOR con2_finish'; |
| 65 |
SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done'; |
| 66 |
|
| 67 |
--send |
| 68 |
REPLACE INTO t1 VALUES (1,3); |
| 69 |
|
| 70 |
--connection default |
| 71 |
SET debug_sync = 'now WAIT_FOR con2_blocked'; |
| 72 |
|
| 73 |
connection purge_control; |
| 74 |
COMMIT; |
| 75 |
disconnect purge_control; |
| 76 |
connection default; |
| 77 |
|
| 78 |
# Wait for purge to delete the delete-marked record |
| 79 |
--source ../../innodb/include/wait_all_purged.inc |
| 80 |
|
| 81 |
SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done'; |
| 82 |
SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done'; |
| 83 |
|
| 84 |
SET debug_sync = 'now SIGNAL con1_finish'; |
| 85 |
|
| 86 |
--connection con1 |
| 87 |
--reap |
| 88 |
--disconnect con1 |
| 89 |
--connection default |
| 90 |
SET debug_sync = 'now SIGNAL con2_finish'; |
| 91 |
|
| 92 |
--connection con2 |
| 93 |
--error 0,ER_LOCK_WAIT_TIMEOUT |
| 94 |
--reap |
| 95 |
--disconnect con2 |
| 96 |
|
| 97 |
--connection default |
| 98 |
SET DEBUG_SYNC= 'RESET'; |
| 99 |
|
| 100 |
SELECT * FROM t1; |
| 101 |
CHECK TABLE t1; |
| 102 |
|
| 103 |
DROP TABLE t1; |
| 104 |
|
| 105 |
SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc; |
| 106 |
SET GLOBAL transaction_isolation = @old_tx_isolation; |
| 107 |
SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout; |
| 108 |
|
| 109 |
--inc $i |
| 110 |
} |