Commit bb6d674d authored by Monty's avatar Monty Committed by Sergei Golubchik

Fixed assertion Assertion `!table->pos_in_locked_tables' failed

MDEV-19591
Assertion `!table->pos_in_locked_tables' failed in tc_release_table upon
altering table into S3 under lock.

The problem was that thd->open_tables->pos_in_locked_tables was not reset
when alter table failed to reopen a locked table.
parent 2e665fb2
......@@ -89,6 +89,25 @@ count(*) sum(a) sum(b) sum(c) sum(d)
10 55 155 NULL NULL
drop table t1;
#
# Test ALTER TABLE with locked table for S3
#
create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
lock table t1 write;
alter table t1 add column c int, engine=s3;
ERROR HY000: Table 't1' is read only
unlock tables;
select count(*), sum(a), sum(b), sum(c) from t1;
count(*) sum(a) sum(b) sum(c)
10 55 155 NULL
lock table t1 write;
ERROR HY000: Table 't1' is read only
lock table t1 read;
select count(*), sum(a), sum(b), sum(c) from t1;
count(*) sum(a) sum(b) sum(c)
10 55 155 NULL
unlock tables;
drop table t1;
#
# Test RENAME TABLE
#
create table t1 (a int, b int) engine=aria select seq as a, seq+10 as b from seq_1_to_10;
......
......@@ -59,6 +59,23 @@ show create table t1;
select count(*), sum(a), sum(b), sum(c), sum(d) from t1;
drop table t1;
--echo #
--echo # Test ALTER TABLE with locked table for S3
--echo #
create table t1 (a int, b int) engine=aria select seq as a,seq+10 as b from seq_1_to_10;
lock table t1 write;
--error ER_OPEN_AS_READONLY
alter table t1 add column c int, engine=s3;
unlock tables;
select count(*), sum(a), sum(b), sum(c) from t1;
--error ER_OPEN_AS_READONLY
lock table t1 write;
lock table t1 read;
select count(*), sum(a), sum(b), sum(c) from t1;
unlock tables;
drop table t1;
--echo #
--echo # Test RENAME TABLE
--echo #
......
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