Commit 29b2f3db authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-24545 Sequence created by one connection remains invisible to another

row_merge_is_index_usable(): Allow access to any SEQUENCE, even if it was
created after the read view. SQL sequences are no-rollback tables with no
history at all.
parent 0785771e
...@@ -31,3 +31,16 @@ connection con1; ...@@ -31,3 +31,16 @@ connection con1;
disconnect con1; disconnect con1;
connection default; connection default;
DROP TABLE s1,s2; DROP TABLE s1,s2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect con1,localhost,root,,test;
CREATE SEQUENCE s1 ENGINE=InnoDB;
FLUSH TABLES;
disconnect con1;
connection default;
SELECT NEXTVAL(s1);
NEXTVAL(s1)
1
COMMIT;
DROP TABLE t1;
DROP SEQUENCE s1;
...@@ -56,3 +56,22 @@ FLUSH TABLES; ...@@ -56,3 +56,22 @@ FLUSH TABLES;
--connection default --connection default
DROP TABLE s1,s2; DROP TABLE s1,s2;
#
# MDEV-24545 Sequence created by one connection remains invisible to another
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connect (con1,localhost,root,,test)
CREATE SEQUENCE s1 ENGINE=InnoDB;
FLUSH TABLES;
--disconnect con1
--connection default
SELECT NEXTVAL(s1);
COMMIT;
# Cleanup
DROP TABLE t1;
DROP SEQUENCE s1;
...@@ -4478,7 +4478,7 @@ row_merge_is_index_usable( ...@@ -4478,7 +4478,7 @@ row_merge_is_index_usable(
} }
return(!index->is_corrupted() return(!index->is_corrupted()
&& (index->table->is_temporary() && (index->table->is_temporary() || index->table->no_rollback()
|| index->trx_id == 0 || index->trx_id == 0
|| !trx->read_view.is_open() || !trx->read_view.is_open()
|| trx->read_view.changes_visible( || trx->read_view.changes_visible(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment