mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-21509 Possible hang during purge of history, or rollback
WL#6326 in MariaDB 10.2.2 introduced a potential hang on purge or rollback when an index tree is being shrunk by multiple levels. This fix is based on mysql/mysql-server@f2c5852630 with the main difference that our version of the test case uses DEBUG_SYNC instrumentation on ROLLBACK, not on purge. btr_cur_will_modify_tree(): Simplify the check further. This is the actual bug fix. row_undo_mod_remove_clust_low(), row_undo_mod_clust(): Add DEBUG_SYNC instrumentation for the test case.
This commit is contained in:
119
mysql-test/suite/innodb/r/innodb_bug30113362.result
Normal file
119
mysql-test/suite/innodb/r/innodb_bug30113362.result
Normal file
@@ -0,0 +1,119 @@
|
||||
SET GLOBAL innodb_adaptive_hash_index = false;
|
||||
SET GLOBAL innodb_stats_persistent = false;
|
||||
connect purge_control,localhost,root,,;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connect con2,localhost,root,,;
|
||||
CREATE TABLE t1 (
|
||||
a00 CHAR(255) NOT NULL DEFAULT 'a',
|
||||
a01 CHAR(255) NOT NULL DEFAULT 'a',
|
||||
a02 CHAR(255) NOT NULL DEFAULT 'a',
|
||||
b INT NOT NULL DEFAULT 0,
|
||||
CONSTRAINT pkey PRIMARY KEY(a00, a01, a02)
|
||||
) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45';
|
||||
SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
|
||||
CREATE PROCEDURE data_load_t1()
|
||||
BEGIN
|
||||
DECLARE c1 INT DEFAULT 97;
|
||||
DECLARE c2 INT DEFAULT 97;
|
||||
DECLARE c3 INT DEFAULT 97;
|
||||
WHILE c1 < 102 DO
|
||||
WHILE c2 < 123 DO
|
||||
WHILE c3 < 123 DO
|
||||
INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3));
|
||||
SET c3 = c3 + 1;
|
||||
END WHILE;
|
||||
SET c3 = 97;
|
||||
SET c2 = c2 + 1;
|
||||
END WHILE;
|
||||
SET c2 = 97;
|
||||
SET c1 = c1 + 1;
|
||||
END WHILE;
|
||||
END |
|
||||
call data_load_t1();
|
||||
DROP PROCEDURE data_load_t1;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
|
||||
CLUST_INDEX_SIZE
|
||||
1856
|
||||
connection con2;
|
||||
DELETE FROM t1 WHERE a00 = 'cnm';
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SET a00 = 'cnm';
|
||||
connection purge_control;
|
||||
COMMIT;
|
||||
connection con2;
|
||||
SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
|
||||
ROLLBACK;
|
||||
# Test start
|
||||
connection purge_control;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection con2;
|
||||
DELETE FROM t1 WHERE a00 = 'bii';
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SET a00 = 'bii';
|
||||
SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
|
||||
SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume';
|
||||
ROLLBACK;
|
||||
connection purge_control;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
|
||||
COMMIT;
|
||||
SET DEBUG_SYNC = 'now SIGNAL roll2';
|
||||
connect con1,localhost,root,,;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting';
|
||||
SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
|
||||
SELECT a00 FROM t1 WHERE a00 = 'bii';
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR lockwait1';
|
||||
SET DEBUG_SYNC = 'now SIGNAL resume';
|
||||
connection con1;
|
||||
a00
|
||||
connection con2;
|
||||
connection default;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
|
||||
CLUST_INDEX_SIZE
|
||||
1856
|
||||
DELETE FROM t1 WHERE a00 = 'dpn';
|
||||
COMMIT;
|
||||
INSERT INTO t1 SET a00 = 'dpn';
|
||||
ROLLBACK;
|
||||
ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35';
|
||||
connection purge_control;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection con2;
|
||||
DELETE FROM t1 WHERE a00 = 'cnd';
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SET a00 = 'cnd';
|
||||
SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
|
||||
SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2';
|
||||
ROLLBACK;
|
||||
connection purge_control;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
SET DEBUG_SYNC = 'now SIGNAL roll2';
|
||||
connection con1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
|
||||
SET DEBUG_SYNC = 'now SIGNAL resume';
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
|
||||
disconnect purge_control;
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now SIGNAL resume';
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
|
||||
CLUST_INDEX_SIZE
|
||||
1856
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
DROP TABLE t1;
|
Reference in New Issue
Block a user