Commit 59f01194 authored by Monty's avatar Monty

MDEV-22686 # Assertion `trn' failed in ha_maria::start_stmt

Calling stmt rollback closed the transaction, which caused the above issue
parent 6532b100
......@@ -31,3 +31,32 @@ select * from t2;
f1 f2
3 qux
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (b INT);
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SELECT * from t1;
a
1
SELECT * from t2;
a
1
BEGIN;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SELECT * from t2;
a
1
COMMIT;
LOCK TABLES t1 read, t2 write;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SELECT * from t2;
a
1
UNLOCK TABLES;
CREATE TABLE t3 (a INT) engine=Aria;
INSERT INTO t3 values(2);
CREATE OR REPLACE TABLE t2 AS SELECT t1.a,t3.a as b FROM t1,t3;
SELECT * from t2;
a b
1 2
DROP TABLE t1, t2, t3;
......@@ -40,3 +40,38 @@ INSERT IGNORE INTO t1 VALUES (1),(2);
CREATE OR REPLACE TABLE t2 ENGINE=Aria AS SELECT SUM(a) AS f1, IFNULL( 'qux', ExtractValue( 'foo', 'bar' ) ) AS f2 FROM t1;
select * from t2;
DROP TABLE t1, t2;
#
# MDEV-22686 # Assertion `trn' failed in ha_maria::start_stmt
# ASAN heap-after-free in maria_status
#
CREATE TABLE t1 (a INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (b INT);
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SELECT * from t1;
SELECT * from t2;
# Check also BEGIN/COMMIT
BEGIN;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SELECT * from t2;
COMMIT;
# Check also LOCK TABLES
LOCK TABLES t1 read, t2 write;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SELECT * from t2;
UNLOCK TABLES;
# Check with 3 tables
CREATE TABLE t3 (a INT) engine=Aria;
INSERT INTO t3 values(2);
CREATE OR REPLACE TABLE t2 AS SELECT t1.a,t3.a as b FROM t1,t3;
SELECT * from t2;
DROP TABLE t1, t2, t3;
......@@ -3450,7 +3450,10 @@ static int maria_rollback(handlerton *hton, THD *thd, bool all)
ER_DATA_WAS_COMMITED_UNDER_ROLLBACK,
ER_THD(thd, ER_DATA_WAS_COMMITED_UNDER_ROLLBACK),
"Aria");
if (all)
DBUG_RETURN(maria_commit(hton, thd, all));
/* Statement rollbacks are ignored. Commit will happen in external_lock */
DBUG_RETURN(0);
}
#else
......
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