Skip to content

Commit

Permalink
MDEV-31570 gap_lock_split.test hangs sporadically
Browse files Browse the repository at this point in the history
The fix is in replacing the waiting for the whole purge finishing
with the the waiting for only delete-marked records purging finishing.

Reviewed by: Marko Mäkelä
  • Loading branch information
vlad-lesin committed Jun 28, 2023
1 parent 687fd6b commit 3e89b4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions mysql-test/suite/innodb/r/gap_lock_split.result
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB;
CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000))
ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023;
connect con1,localhost,root,,;
InnoDB 0 transactions not purged
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1 WHERE id=1788;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@GLOBAL.debug_dbug="d,enable_row_purge_del_mark_exit_sync_point";
BEGIN;
SELECT * FROM t1 WHERE id=1788 FOR UPDATE;
id val
connection con1;
COMMIT;
InnoDB 0 transactions not purged
SET DEBUG_SYNC = 'now WAIT_FOR row_purge_del_mark_finished';
SET @@GLOBAL.debug_dbug = @saved_dbug;
connection default;
INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000));
connection con1;
Expand Down
11 changes: 9 additions & 2 deletions mysql-test/suite/innodb/t/gap_lock_split.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc

SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;

CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB;
CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000))
ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023;

connect(con1,localhost,root,,);
Expand All @@ -16,13 +18,18 @@ connection default;

DELETE FROM t1 WHERE id=1788;

SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@GLOBAL.debug_dbug="d,enable_row_purge_del_mark_exit_sync_point";

BEGIN;
# This will return no result, but should acquire a gap lock.
SELECT * FROM t1 WHERE id=1788 FOR UPDATE;

connection con1;
COMMIT;
source include/wait_all_purged.inc;
SET DEBUG_SYNC = 'now WAIT_FOR row_purge_del_mark_finished';
SET @@GLOBAL.debug_dbug = @saved_dbug;

connection default;

INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000));
Expand Down

0 comments on commit 3e89b4f

Please sign in to comment.