summaryrefslogtreecommitdiff
path: root/mysql-test/suite
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-01-12 15:13:58 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-01-12 23:50:23 +0300
commit6d8794e5670134196bc871f8c6b8406b1ac8cb85 (patch)
tree0121f2b22320bdb7211594deb73e4eaedacda1f2 /mysql-test/suite
parent6b4f0d782c973bd49ad62a67add36d4773852c3a (diff)
downloadmariadb-git-6d8794e5670134196bc871f8c6b8406b1ac8cb85.tar.gz
MDEV-21650 Non-empty statement transaction on global rollback after TRT update error
TRT opens statement transaction. Cleanup it in case of error.
Diffstat (limited to 'mysql-test/suite')
-rw-r--r--mysql-test/suite/versioning/r/trx_id.result28
-rw-r--r--mysql-test/suite/versioning/r/update.result2
-rw-r--r--mysql-test/suite/versioning/t/trx_id.test35
-rw-r--r--mysql-test/suite/versioning/t/update.test2
4 files changed, 65 insertions, 2 deletions
diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result
index 1210262fcd0..9ddfb2d33dd 100644
--- a/mysql-test/suite/versioning/r/trx_id.result
+++ b/mysql-test/suite/versioning/r/trx_id.result
@@ -528,3 +528,31 @@ drop table t;
uninstall plugin test_versioning;
select trt_begin_ts(0);
ERROR 42000: FUNCTION test.trt_begin_ts does not exist
+#
+# MDEV-21650 Non-empty statement transaction on global rollback after TRT update error
+#
+create table t1 (s date, e date, period for app(s,e)) engine=innodb;
+alter table t1
+add row_start bigint unsigned as row start,
+add row_end bigint unsigned as row end,
+add period for system_time(row_start,row_end),
+with system versioning,
+add period if not exists for app(x,y);
+Warnings:
+Note 1060 Duplicate column name 'app'
+set transaction isolation level serializable;
+start transaction;
+insert into t1 (s,e) values ('2021-07-04','2024-08-18');
+connect con1,localhost,root,,test;
+start transaction;
+insert into t1 (s,e) values ('2018-06-01','2021-09-15');
+connection default;
+select * from t1 for system_time as of now();
+ERROR HY000: TRX_ID ... not found in `mysql.transaction_registry`
+connection con1;
+set innodb_lock_wait_timeout= 1, lock_wait_timeout= 1;
+alter table xx;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+disconnect con1;
+connection default;
+drop table t1;
diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result
index da893432749..201c90216af 100644
--- a/mysql-test/suite/versioning/r/update.result
+++ b/mysql-test/suite/versioning/r/update.result
@@ -401,7 +401,7 @@ a check_row(row_start, row_end)
drop tables t1, t2, t3;
#
# MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob
-
+#
create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning;
insert into t1 values (1, 1, 'foo'), (2, 11, 'bar');
update t1 set a = 3 where b <= 9;
diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test
index 08f183536f6..f3784f1b068 100644
--- a/mysql-test/suite/versioning/t/trx_id.test
+++ b/mysql-test/suite/versioning/t/trx_id.test
@@ -540,3 +540,38 @@ drop table t;
uninstall plugin test_versioning;
--error ER_SP_DOES_NOT_EXIST
select trt_begin_ts(0);
+
+--echo #
+--echo # MDEV-21650 Non-empty statement transaction on global rollback after TRT update error
+--echo #
+create table t1 (s date, e date, period for app(s,e)) engine=innodb;
+alter table t1
+ add row_start bigint unsigned as row start,
+ add row_end bigint unsigned as row end,
+ add period for system_time(row_start,row_end),
+ with system versioning,
+ add period if not exists for app(x,y);
+
+set transaction isolation level serializable;
+start transaction;
+insert into t1 (s,e) values ('2021-07-04','2024-08-18');
+
+--connect (con1,localhost,root,,test)
+start transaction;
+insert into t1 (s,e) values ('2018-06-01','2021-09-15');
+
+--connection default
+--replace_regex /TRX_ID \d+/TRX_ID .../
+--error ER_VERS_NO_TRX_ID
+select * from t1 for system_time as of now();
+
+--connection con1
+set innodb_lock_wait_timeout= 1, lock_wait_timeout= 1;
+# can be existing or non-existing table, does not matter
+--error ER_LOCK_WAIT_TIMEOUT
+alter table xx;
+
+# cleanup
+--disconnect con1
+--connection default
+drop table t1;
diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test
index 47a56a71bd3..652388e14ff 100644
--- a/mysql-test/suite/versioning/t/update.test
+++ b/mysql-test/suite/versioning/t/update.test
@@ -328,7 +328,7 @@ drop tables t1, t2, t3;
--echo #
--echo # MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob
---echo
+--echo #
create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning;
insert into t1 values (1, 1, 'foo'), (2, 11, 'bar');