Skip to content

Commit 9c85542

Browse files
FooBarriorvuvova
authored andcommitted
MDEV-31775 Server crash upon online alter on sequence
Forbid online for sequences. It doesn't work now and sequence tables are always only one row, so not worth the extra complexity.
1 parent 7d0d9ea commit 9c85542

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

mysql-test/main/alter_table_online.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,8 @@ create temporary table t (f int);
219219
alter table t force, algorithm=instant;
220220
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY
221221
drop table t;
222+
create sequence s engine=MyISAM;
223+
alter table s engine=Aria, lock=none;
224+
ERROR 0A000: LOCK=NONE is not supported. Reason: SEQUENCE. Try LOCK=SHARED
225+
alter table s engine=Aria;
226+
drop sequence s;

mysql-test/main/alter_table_online.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,9 @@ create temporary table t (f int);
222222
--error ER_ALTER_OPERATION_NOT_SUPPORTED
223223
alter table t force, algorithm=instant;
224224
drop table t;
225+
226+
create sequence s engine=MyISAM;
227+
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
228+
alter table s engine=Aria, lock=none;
229+
alter table s engine=Aria;
230+
drop sequence s;

sql/sql_table.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9916,6 +9916,10 @@ const char *online_alter_check_supported(const THD *thd,
99169916
if (!*online)
99179917
return NULL;
99189918

9919+
*online= table->s->sequence == NULL;
9920+
if (!*online)
9921+
return "SEQUENCE";
9922+
99199923
*online= (alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING) == 0;
99209924
if (!*online)
99219925
return "DROP SYSTEM VERSIONING";

0 commit comments

Comments
 (0)