Skip to content

Commit e1f5c58

Browse files
FooBarriorvuvova
authored andcommitted
MDEV-30891 Assertion `!table->versioned(VERS_TRX_ID)' failed
Assertion `!table->versioned(VERS_TRX_ID)' failed in Write_rows_log_event::binlog_row_logging_function during ONLINE ALTER. trxid-versioned tables can't be replicated. ONLINE ALTER will also be forbidden for these tables.
1 parent 5361b87 commit e1f5c58

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

mysql-test/main/alter_table_online.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,19 @@ ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock.
120120
alter table t2 add c int, algorithm=copy;
121121
alter table t2 add d int, algorithm=inplace;
122122
drop table t2, t1;
123+
#
124+
# MDEV-30891 Assertion `!table->versioned(VERS_TRX_ID)' failed
125+
# in Write_rows_log_event::binlog_row_logging_function
126+
#
127+
set system_versioning_alter_history= keep;
128+
create table t1 (id int,
129+
row_start bigint unsigned generated always as row start,
130+
row_end bigint unsigned generated always as row end,
131+
period for system_time (row_start, row_end))
132+
engine=innodb with system versioning;
133+
alter table t1 add c int, algorithm=copy, lock=none;
134+
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
135+
alter table t1 add c int, algorithm=inplace;
136+
alter table t1 add d int, lock=none;
137+
set system_versioning_alter_history= default;
138+
drop table t1;

mysql-test/main/alter_table_online.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,23 @@ alter table t2 add c int, algorithm=copy;
115115
alter table t2 add d int, algorithm=inplace;
116116
# Cleanup
117117
drop table t2, t1;
118+
119+
--echo #
120+
--echo # MDEV-30891 Assertion `!table->versioned(VERS_TRX_ID)' failed
121+
--echo # in Write_rows_log_event::binlog_row_logging_function
122+
--echo #
123+
set system_versioning_alter_history= keep;
124+
create table t1 (id int,
125+
row_start bigint unsigned generated always as row start,
126+
row_end bigint unsigned generated always as row end,
127+
period for system_time (row_start, row_end))
128+
engine=innodb with system versioning;
129+
130+
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
131+
alter table t1 add c int, algorithm=copy, lock=none;
132+
alter table t1 add c int, algorithm=inplace;
133+
alter table t1 add d int, lock=none;
134+
135+
set system_versioning_alter_history= default;
136+
drop table t1;
137+

sql/sql_table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10069,7 +10069,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
1006910069
table= table_list->table;
1007010070
bool is_reg_table= table->s->tmp_table == NO_TMP_TABLE;
1007110071

10072-
online= online && !table->s->tmp_table;
10072+
online= online && !table->s->tmp_table && !table->versioned(VERS_TRX_ID);
1007310073

1007410074
List<FOREIGN_KEY_INFO> fk_list;
1007510075
table->file->get_foreign_key_list(thd, &fk_list);

0 commit comments

Comments
 (0)