mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
845c939601
if ALTER TABLE ... LOCK=xxx is executed under LOCK TABLES, ignore the LOCK clause, because ALTER should not downgrade already taken EXCLUSIVE table lock to SHARED or NONE. This commit preserves the existing behavior (LOCK was de facto ignored), but makes it explicit.
62 lines
2.1 KiB
Text
62 lines
2.1 KiB
Text
#
|
|
# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
|
|
# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
|
|
#
|
|
SET @max_session_mem_used_save= @@max_session_mem_used;
|
|
CREATE TABLE t1 (a INT);
|
|
SELECT * FROM t1;
|
|
a
|
|
ALTER TABLE x MODIFY xx INT;
|
|
ERROR 42S02: Table 'test.x' doesn't exist
|
|
SET SESSION max_session_mem_used= 8192;
|
|
LOCK TABLE t1 WRITE;
|
|
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
|
|
SET SESSION max_session_mem_used = @max_session_mem_used_save;
|
|
UNLOCK TABLES;
|
|
DROP TABLE t1;
|
|
#
|
|
# End of 10.5 tests
|
|
#
|
|
#
|
|
# MDEV-28943 Online alter fails under LOCK TABLE with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
|
#
|
|
create table t1 (f int) engine=innodb;
|
|
insert t1 values (1);
|
|
alter table t1 force, algorithm=copy, lock=none;
|
|
alter table t1 force, algorithm=inplace, lock=none;
|
|
alter table t1 force, algorithm=copy, lock=shared;
|
|
alter table t1 force, algorithm=inplace, lock=shared;
|
|
alter table t1 force, algorithm=copy, lock=exclusive;
|
|
alter table t1 force, algorithm=inplace, lock=exclusive;
|
|
lock table t1 write;
|
|
connect con1, localhost, root;
|
|
select count(*) as 'must be 0' from t1;
|
|
connection default;
|
|
alter table t1 force, algorithm=copy, lock=none;
|
|
alter table t1 force, algorithm=inplace, lock=none;
|
|
alter table t1 force, algorithm=copy, lock=shared;
|
|
alter table t1 force, algorithm=inplace, lock=shared;
|
|
alter table t1 force, algorithm=copy, lock=exclusive;
|
|
alter table t1 force, algorithm=inplace, lock=exclusive;
|
|
delete from t1;
|
|
unlock tables;
|
|
connection con1;
|
|
must be 0
|
|
0
|
|
connection default;
|
|
drop table t1;
|
|
#
|
|
# MDEV-29056 Replica SQL thread stops with 1846 error on ALTER ONLINE after LOCK WRITE
|
|
#
|
|
create table t1 (c varchar(1), key (c)) engine=innodb;
|
|
insert into t1 (c) values ('g') ;
|
|
alter table t1 add fulltext key(c), algorithm=inplace;
|
|
alter online table t1 add column s blob not null, algorithm=inplace;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
|
|
lock table t1 write;
|
|
alter online table t1 add column s blob not null, algorithm=inplace;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
|
|
drop table t1;
|
|
#
|
|
# End of 10.11 tests
|
|
#
|