| 1 |
# |
| 2 |
# Bug #30258536 DEADLOCK BETWEEN LOB::ALLOC_LOB_PAGE AND ROW_UNDO_MOD_CLUST_LOW |
| 3 |
# |
| 4 |
--source include/have_debug_sync.inc |
| 5 |
--source include/have_innodb_16k.inc |
| 6 |
--source include/count_sessions.inc |
| 7 |
|
| 8 |
# We want the pages released during ROLLBACK |
| 9 |
# to be reused by transaction doing INSERT. |
| 10 |
# It is easier if they operate on two different |
| 11 |
# tables (t1 and t2) as then we don't have to |
| 12 |
# worry them being serialized because of accessing |
| 13 |
# the index lock. |
| 14 |
# On the other hand, pages are reused within a TABLESPACE, |
| 15 |
# so we make sure both tables reside in the same one. |
| 16 |
CREATE TABLESPACE ts1; |
| 17 |
|
| 18 |
CREATE TABLE t1 ( |
| 19 |
id INT PRIMARY KEY, |
| 20 |
make_big CHAR(200), |
| 21 |
val LONGBLOB |
| 22 |
) TABLESPACE ts1; |
| 23 |
CREATE TABLE t2 ( |
| 24 |
id INT PRIMARY KEY, |
| 25 |
make_big CHAR(200), |
| 26 |
val LONGBLOB |
| 27 |
) TABLESPACE ts1; |
| 28 |
|
| 29 |
INSERT INTO t1 (id,val) VALUES (1,REPEAT('a',1000000)); |
| 30 |
INSERT INTO t2 (id,val) VALUES (1,REPEAT('a',1000000)); |
| 31 |
INSERT INTO t1 (id,val) VALUES (2,REPEAT('a',1000000)); |
| 32 |
INSERT INTO t2 (id,val) VALUES (2,REPEAT('a',1000000)); |
| 33 |
INSERT INTO t1 (id,val) VALUES (3,REPEAT('a',1000000)); |
| 34 |
# Length of the following blob is chosen in such a way, that the |
| 35 |
# first page of the LOB which we will allocate by the following UPDATE t2 |
| 36 |
# will be first page of an extent, and therefore, the rollback of the |
| 37 |
# UPDATE will free the extent and make it available for the following |
| 38 |
# INSERT INTO t1. |
| 39 |
INSERT INTO t2 (id,val) VALUES (3,REPEAT('a',523809)); |
| 40 |
|
| 41 |
--connect (con1,localhost,root,,) |
| 42 |
--connect (con2,localhost,root,,) |
| 43 |
|
| 44 |
--connection con1 |
| 45 |
BEGIN; |
| 46 |
UPDATE t2 SET val = REPEAT('b',10000) WHERE id=3; |
| 47 |
SET DEBUG_SYNC= |
| 48 |
'ib_blob_update_rollback_will_reserve |
| 49 |
SIGNAL con1_will_reserve |
| 50 |
WAIT_FOR con1_can_reserve'; |
| 51 |
--send ROLLBACK |
| 52 |
|
| 53 |
--connection default |
| 54 |
SET DEBUG_SYNC='now WAIT_FOR con1_will_reserve'; |
| 55 |
|
| 56 |
--connection con2 |
| 57 |
BEGIN; |
| 58 |
--send INSERT INTO t1 (id,val) VALUES (4000,REPEAT('b',1000000)) |
| 59 |
|
| 60 |
--connection default |
| 61 |
# I am sorry about this sleep. What we really wait for is a |
| 62 |
# call to buf_page_get_gen with page_no equal to the page |
| 63 |
# which was previously freed by the ROLLBACK of UPDATE. |
| 64 |
# It's not easy to hard code this, and there are multiple |
| 65 |
# calls to buf_page_get_gen() before it happens. |
| 66 |
--sleep 1 |
| 67 |
SET DEBUG_SYNC='now SIGNAL con1_can_reserve'; |
| 68 |
|
| 69 |
--connection con1 |
| 70 |
--reap |
| 71 |
|
| 72 |
--connection con2 |
| 73 |
--reap |
| 74 |
ROLLBACK; |
| 75 |
|
| 76 |
--connection default |
| 77 |
--disconnect con1 |
| 78 |
--disconnect con2 |
| 79 |
|
| 80 |
DROP TABLE t1; |
| 81 |
DROP TABLE t2; |
| 82 |
DROP TABLESPACE ts1; |
| 83 |
|
| 84 |
--source include/wait_until_count_sessions.inc |