diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2022-03-29 13:44:14 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2022-03-29 13:44:14 +0300 |
commit | 58cd2a8dedd78b25ada0996dee2bd3e0520c17b6 (patch) | |
tree | 0053d73f9e800719cbb29ebac8f0ca4bdf074a93 | |
parent | 020e7d89ebdcded3355c82cec93e0abef2898258 (diff) | |
download | mariadb-git-58cd2a8dedd78b25ada0996dee2bd3e0520c17b6.tar.gz |
MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image()
Throw ER_NOT_FORM_FILE if this is wrong FRM data (warning with
ER_VERS_FIELD_WRONG_TYPE is still printed for deeper knowledge of what
was happened).
Keep ER_VERS_FIELD_WRONG_TYPE for creating partitioned table with
trx-versioning. Tested by MDEV-15951 in trx_id.test
-rw-r--r-- | mysql-test/suite/versioning/r/debug.result | 14 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/debug.test | 13 | ||||
-rw-r--r-- | sql/table.cc | 13 |
3 files changed, 35 insertions, 5 deletions
diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result index 72bd1f18a68..20e21ff2811 100644 --- a/mysql-test/suite/versioning/r/debug.result +++ b/mysql-test/suite/versioning/r/debug.result @@ -50,5 +50,17 @@ t4 CREATE TABLE `t4` ( `row_end` timestamp(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING -set global debug_dbug=@old_dbug; drop table t1, t2, t3, t4; +# +# MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() +# +create table t1 (x int) with system versioning; +set debug_dbug='+d,error_vers_wrong_type'; +show create table t1; +ERROR HY000: Incorrect information in file: './test/t1.frm' +show warnings; +Level Code Message +Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` +Error 1033 Incorrect information in file: './test/t1.frm' +drop table t1; +set global debug_dbug=@old_dbug; diff --git a/mysql-test/suite/versioning/t/debug.test b/mysql-test/suite/versioning/t/debug.test index c6d5bd60861..59dde0d26fb 100644 --- a/mysql-test/suite/versioning/t/debug.test +++ b/mysql-test/suite/versioning/t/debug.test @@ -30,6 +30,17 @@ set debug_dbug='+d,sysvers_show'; show create table t3; create table t4 (a int); show create table t4; +drop table t1, t2, t3, t4; + +--echo # +--echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() +--echo # +create table t1 (x int) with system versioning; +set debug_dbug='+d,error_vers_wrong_type'; +--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/' +--error ER_NOT_FORM_FILE +show create table t1; +show warnings; +drop table t1; set global debug_dbug=@old_dbug; -drop table t1, t2, t3, t4; diff --git a/sql/table.cc b/sql/table.cc index 2ab947d69cd..7d022ba8ca3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2082,6 +2082,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (flags & VERS_SYSTEM_FIELD) { + if (DBUG_EVALUATE_IF("error_vers_wrong_type", 1, 0)) + field_type= MYSQL_TYPE_BLOB; + switch (field_type) { case MYSQL_TYPE_TIMESTAMP2: @@ -2094,9 +2097,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, } /* Fallthrough */ default: - my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), fieldnames.type_names[i], - versioned == VERS_TIMESTAMP ? "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED", - table_name.str); + my_error(ER_VERS_FIELD_WRONG_TYPE, + (field_type == MYSQL_TYPE_LONGLONG ? + MYF(0) : MYF(ME_WARNING)), + fieldnames.type_names[i], + (versioned == VERS_TIMESTAMP ? + "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED"), + table_name.str); goto err; } } |