diff --git a/mysql-test/main/alter_table_online.result b/mysql-test/main/alter_table_online.result index e8c67c5fb39..0b7f87270c0 100644 --- a/mysql-test/main/alter_table_online.result +++ b/mysql-test/main/alter_table_online.result @@ -120,3 +120,19 @@ ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. alter table t2 add c int, algorithm=copy; alter table t2 add d int, algorithm=inplace; drop table t2, t1; +# +# MDEV-30891 Assertion `!table->versioned(VERS_TRX_ID)' failed +# in Write_rows_log_event::binlog_row_logging_function +# +set system_versioning_alter_history= keep; +create table t1 (id int, +row_start bigint unsigned generated always as row start, +row_end bigint unsigned generated always as row end, +period for system_time (row_start, row_end)) +engine=innodb with system versioning; +alter table t1 add c int, algorithm=copy, lock=none; +ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED +alter table t1 add c int, algorithm=inplace; +alter table t1 add d int, lock=none; +set system_versioning_alter_history= default; +drop table t1; diff --git a/mysql-test/main/alter_table_online.test b/mysql-test/main/alter_table_online.test index e2a4e085d26..b9e147c812d 100644 --- a/mysql-test/main/alter_table_online.test +++ b/mysql-test/main/alter_table_online.test @@ -115,3 +115,23 @@ alter table t2 add c int, algorithm=copy; alter table t2 add d int, algorithm=inplace; # Cleanup drop table t2, t1; + +--echo # +--echo # MDEV-30891 Assertion `!table->versioned(VERS_TRX_ID)' failed +--echo # in Write_rows_log_event::binlog_row_logging_function +--echo # +set system_versioning_alter_history= keep; +create table t1 (id int, + row_start bigint unsigned generated always as row start, + row_end bigint unsigned generated always as row end, + period for system_time (row_start, row_end)) + engine=innodb with system versioning; + +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter table t1 add c int, algorithm=copy, lock=none; +alter table t1 add c int, algorithm=inplace; +alter table t1 add d int, lock=none; + +set system_versioning_alter_history= default; +drop table t1; + diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 306b16a51f6..5463de381fb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10069,7 +10069,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, table= table_list->table; bool is_reg_table= table->s->tmp_table == NO_TMP_TABLE; - online= online && !table->s->tmp_table; + online= online && !table->s->tmp_table && !table->versioned(VERS_TRX_ID); List fk_list; table->file->get_foreign_key_list(thd, &fk_list);