diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2020-02-20 18:42:27 +1000 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2020-02-20 18:42:27 +1000 |
commit | e0e845c5d8630733f6d31cbd42887221b1352e76 (patch) | |
tree | b02d2021fb4b8196e032339231f908e9346dd043 | |
parent | 5a42a114fdc9cacb6e64b5c61097e7759036b11c (diff) | |
download | mariadb-git-bb-10.4-MDEV-20494.tar.gz |
MDEV-20494 ER_NOT_FORM_FILE or Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon adding partition to a versioned tablebb-10.4-MDEV-20494
Problem: fast_alter_partition_table tries to write the shadow frm with zero-length period constraint name. In case of explicit write-lock table reopens and shadow frm is read. Period constraint name is saved to frm in format "zero means two bytes more" (see extra2_write_str/extra2_read_len), so zero value here corrupts frm.
Solution: generate constraint names before fast_alter_partition_table is issued
-rw-r--r-- | mysql-test/suite/period/r/alter.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/period/t/alter.test | 12 | ||||
-rw-r--r-- | sql/sql_table.cc | 8 |
3 files changed, 27 insertions, 3 deletions
diff --git a/mysql-test/suite/period/r/alter.result b/mysql-test/suite/period/r/alter.result index e202ba2698f..9eeaa222bcd 100644 --- a/mysql-test/suite/period/r/alter.result +++ b/mysql-test/suite/period/r/alter.result @@ -174,3 +174,13 @@ alter table t add constraint mytime_1 check (x > 2); insert t values (3, @e, @s); ERROR 23000: CONSTRAINT `mytime_2` failed for `test`.`t` drop table t; +# +# MDEV-20494 ER_NOT_FORM_FILE or Assertion +# `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' +# failed upon adding partition to a versioned table +create table t1 (f date, t date, period for app(f,t)) with system versioning partition by system_time ( partition p1 history, partition pn current ); +lock table t1 write; +alter table t1 add partition (partition p2 history); +Warnings: +Warning 4115 Maybe missing parameters: no rotation condition for multiple HISTORY partitions. +drop table t1; diff --git a/mysql-test/suite/period/t/alter.test b/mysql-test/suite/period/t/alter.test index 3f45d68cd61..bfbf8658c07 100644 --- a/mysql-test/suite/period/t/alter.test +++ b/mysql-test/suite/period/t/alter.test @@ -1,3 +1,5 @@ +--source include/have_partition.inc + set @s= '1992-01-01'; set @e= '1999-12-31'; @@ -131,3 +133,13 @@ alter table t add constraint mytime_1 check (x > 2); insert t values (3, @e, @s); drop table t; + +--echo # +--echo # MDEV-20494 ER_NOT_FORM_FILE or Assertion +--echo # `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' +--echo # failed upon adding partition to a versioned table + +create table t1 (f date, t date, period for app(f,t)) with system versioning partition by system_time ( partition p1 history, partition pn current ); +lock table t1 write; +alter table t1 add partition (partition p2 history); +drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 851a63bf05a..694fb60546b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -9728,9 +9728,7 @@ do_continue:; } if (handle_if_exists_options(thd, table, alter_info, - &create_info->period_info) || - fix_constraints_names(thd, &alter_info->check_constraint_list, - create_info)) + &create_info->period_info)) DBUG_RETURN(true); /* @@ -9811,6 +9809,10 @@ do_continue:; DBUG_RETURN(true); } + if (fix_constraints_names(thd, &alter_info->check_constraint_list, + create_info)) + DBUG_RETURN(true); + set_table_default_charset(thd, create_info, alter_ctx.db); if (create_info->check_fields(thd, alter_info, |