| 1 |
# |
| 2 |
# Bug #30258536 DEADLOCK BETWEEN LOB::ALLOC_LOB_PAGE AND ROW_UNDO_MOD_CLUST_LOW |
| 3 |
# |
| 4 |
# This scenario is for regression caused by fix for |
| 5 |
# Bug #30178056 .IBD FILE GROWS INDEFINITELY FOR TABLES WITH BLOB COLUMNS |
| 6 |
# which introduced an operation which latches first page during ROLLBACK, |
| 7 |
# that leads to a failure of the assertion introduced in |
| 8 |
# Bug #27777959 INNODB: ASSERTION FAILURE: UT0UT.CC DUE TO DEADLOCK AT FSP_PAGE_CREATE() |
| 9 |
# which states that the first page of zLOB should not be latched during lob::z_rollback. |
| 10 |
# This test demonstrates that it is not sufficient to simply remove the failing assert |
| 11 |
# from code, as then the server will deadlock when the thread which ROLLBACKs tries |
| 12 |
# to latch space to reserve pages, holding the latch on zLOB's freed first page, while |
| 13 |
# the thread doing INSERT tries to latch the freed page, while holding space latch. |
| 14 |
# |
| 15 |
# This scenario is somewhat similar to innodb.lob_rollback_deadlock, differing by: |
| 16 |
# - uses FORMAT=compressed |
| 17 |
# - uses different lengths of blobs to arrange for a particular situation |
| 18 |
# - modifies the zBLOB from very short (which fits inline) to very long |
| 19 |
# (which requires indexing) and then rollsback |
| 20 |
--source include/have_debug_sync.inc |
| 21 |
--source include/have_innodb_16k.inc |
| 22 |
--source include/count_sessions.inc |
| 23 |
|
| 24 |
SET GLOBAL innodb_compression_level = 0; |
| 25 |
CREATE TABLESPACE ts1 FILE_BLOCK_SIZE=8K; |
| 26 |
|
| 27 |
CREATE TABLE t1 ( |
| 28 |
id INT PRIMARY KEY, |
| 29 |
make_big CHAR(200), |
| 30 |
val LONGBLOB |
| 31 |
) ROW_FORMAT=compressed TABLESPACE ts1; |
| 32 |
CREATE TABLE t2 ( |
| 33 |
id INT PRIMARY KEY, |
| 34 |
make_big CHAR(200), |
| 35 |
val LONGBLOB |
| 36 |
) ROW_FORMAT=compressed TABLESPACE ts1; |
| 37 |
|
| 38 |
INSERT INTO t2 (id,val) VALUES (1,REPEAT('a',1000000)); |
| 39 |
INSERT INTO t1 (id,val) VALUES (2,REPEAT('a',1000000)); |
| 40 |
INSERT INTO t2 (id,val) VALUES (2,REPEAT('a',1000000)); |
| 41 |
INSERT INTO t1 (id,val) VALUES (3,REPEAT('a',1000000)); |
| 42 |
# Length of the following blobs is chosen in such a way, that the |
| 43 |
# first page of the LOB which we will allocate by the following UPDATE t2 |
| 44 |
# will be first page of an extent, and therefore, the rollback of the |
| 45 |
# UPDATE will free the extent and make it available for the following |
| 46 |
# INSERT INTO t1. |
| 47 |
# We need a very short blob (here: 13 chars) so that it fits inline. |
| 48 |
INSERT INTO t2 (id,val) VALUES (3,REPEAT('a',312000)); |
| 49 |
INSERT INTO t2 (id,val) VALUES (4,REPEAT('a',13)); |
| 50 |
|
| 51 |
--connect (con1,localhost,root,,) |
| 52 |
--connect (con2,localhost,root,,) |
| 53 |
|
| 54 |
--connection con1 |
| 55 |
BEGIN; |
| 56 |
UPDATE t2 SET val = REPEAT('b',1000000) WHERE id=4; |
| 57 |
|
| 58 |
SET DEBUG_SYNC= |
| 59 |
'ib_blob_update_rollback_will_reserve |
| 60 |
SIGNAL con1_will_reserve |
| 61 |
WAIT_FOR con1_can_reserve'; |
| 62 |
--send ROLLBACK |
| 63 |
|
| 64 |
--connection default |
| 65 |
SET DEBUG_SYNC='now WAIT_FOR con1_will_reserve'; |
| 66 |
|
| 67 |
--connection con2 |
| 68 |
BEGIN; |
| 69 |
--send INSERT INTO t1 (id,val) VALUES (4000,REPEAT('b',10000000)) |
| 70 |
|
| 71 |
--connection default |
| 72 |
# I am sorry about this sleep. What we really wait for is a |
| 73 |
# call to buf_page_get_gen with page_no equal to the page |
| 74 |
# which was previously freed by the ROLLBACK of UPDATE. |
| 75 |
# It's not easy to hard code this, and there are multiple |
| 76 |
# calls to buf_page_get_gen() before it happens. |
| 77 |
--sleep 1 |
| 78 |
SET DEBUG_SYNC='now SIGNAL con1_can_reserve'; |
| 79 |
|
| 80 |
--connection con1 |
| 81 |
--reap |
| 82 |
|
| 83 |
--connection con2 |
| 84 |
--reap |
| 85 |
ROLLBACK; |
| 86 |
|
| 87 |
--connection default |
| 88 |
--disconnect con1 |
| 89 |
--disconnect con2 |
| 90 |
|
| 91 |
DROP TABLE t1; |
| 92 |
DROP TABLE t2; |
| 93 |
DROP TABLESPACE ts1; |
| 94 |
SET GLOBAL innodb_compression_level = default; |
| 95 |
--source include/wait_until_count_sessions.inc |