| 1 |
CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `b_c` (`b`,`c`)) |
| 2 |
ENGINE=InnoDB, STATS_PERSISTENT=0; |
| 3 |
INSERT INTO t SET a = 1, c = 2; |
| 4 |
connect con1,localhost,root; |
| 5 |
BEGIN; |
| 6 |
INSERT INTO t SET a=2, c=2; |
| 7 |
connection default; |
| 8 |
BEGIN; |
| 9 |
SET DEBUG_SYNC="lock_wait_start SIGNAL select_locked"; |
| 10 |
SELECT * FROM t FORCE INDEX(b) FOR UPDATE; |
| 11 |
connection con1; |
| 12 |
SET DEBUG_SYNC="now WAIT_FOR select_locked"; |
| 13 |
ROLLBACK; |
| 14 |
connection default; |
| 15 |
# If the bug is not fixed, and the both unique index key fields are |
| 16 |
# NULL, there will be two (1, NULL, 2) rows in the result, |
| 17 |
# because cursor will be restored to (NULL, 2, 1) position for |
| 18 |
# secondary key instead of "supremum". |
| 19 |
a b c |
| 20 |
1 NULL 2 |
| 21 |
COMMIT; |
| 22 |
SET DEBUG_SYNC="RESET"; |
| 23 |
disconnect con1; |
| 24 |
DROP TABLE t; |