summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2022-02-14 18:30:51 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2022-02-14 18:30:51 +0300
commitf2f22c382bb510bb069526f1a06155fa4515ea8f (patch)
tree3cac29e7614d27bcf32b8e69839fc81d8fc87940 /mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test
parent7aa09af488d1a5e3e4a0423335e016beb80bbe7f (diff)
parent20e9e804c131c6522bc7c469e4863e8d1eaa3ee0 (diff)
downloadmariadb-git-f2f22c382bb510bb069526f1a06155fa4515ea8f.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test')
-rw-r--r--mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test b/mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test
new file mode 100644
index 00000000000..c9ae258791c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/cursor-restore-non-locking-read.test
@@ -0,0 +1,44 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/count_sessions.inc
+
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+
+CREATE TABLE t1 (pk int PRIMARY KEY, c int UNIQUE) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (10,10),(20,20),(30,30);
+
+--connect(prevent_purge,localhost,root,,)
+start transaction with consistent snapshot;
+# We need this to update page's transaction id for secondary index.
+UPDATE t1 SET c=300 WHERE pk = 30;
+
+--connection default
+DELETE FROM t1 WHERE pk = 10;
+INSERT INTO t1 VALUES(5,10);
+SET DEBUG_SYNC = "row_search_clust_unlatched SIGNAL unlatched WAIT_FOR cont";
+# With the above sync point row_search_mvcc() will be blocked on delete-marked
+# record (10,10) in secondary index just after all page latches are released.
+# After this record is purged, row_searc_mvcc() will be unblocked, and cursor
+# will be restored to the secondary index record (10,5). As the unique field is
+# the same as in the cursor's stored record, and the bug is not fixed, there
+# value 5 will be doubled in the result set.
+--send SELECT pk FROM t1 FORCE INDEX (c)
+
+--connect(con1,localhost,root,,)
+SET DEBUG_SYNC = "now WAIT_FOR unlatched";
+--disconnect prevent_purge
+let $wait_all_purged= 1;
+--source include/wait_all_purged.inc
+SET DEBUG_SYNC = 'now SIGNAL cont';
+--disconnect con1
+
+--connection default
+--reap
+
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+--source include/wait_until_count_sessions.inc