Skip to content

Commit

Permalink
MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
midenok committed Mar 29, 2022
1 parent 020e7d8 commit 58cd2a8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
14 changes: 13 additions & 1 deletion mysql-test/suite/versioning/r/debug.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 12 additions & 1 deletion mysql-test/suite/versioning/t/debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 10 additions & 3 deletions sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 58cd2a8

Please sign in to comment.