Commit 27bf2b3c authored by Sergei Golubchik's avatar Sergei Golubchik

don't error out on unknown options in the

replication thread or when opening a table
parent 6515d719
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
install plugin example soname 'ha_example.so';
set storage_engine=example;
create table t1 (a int not null) ull=12340;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12340
drop table t1;
set storage_engine=default;
select 1;
1
1
uninstall plugin example;
--source include/not_windows_embedded.inc
--source include/have_example_plugin.inc
--source include/master-slave.inc
--replace_regex /\.dll/.so/
eval install plugin example soname $HA_EXAMPLE_SO;
set storage_engine=example;
sync_slave_with_master;
connection master;
#
# only master has example engine installed,
# the slave will have the table created in myisam,
# that does not have ULL table option.
# but because the table was created by the replication
# slave thread, the table will be created anyway, even if
# the option is unknown.
#
create table t1 (a int not null) ull=12340;
show create table t1;
sync_slave_with_master;
connection slave;
show create table t1;
connection master;
drop table t1;
set storage_engine=default;
select 1;
uninstall plugin example;
...@@ -77,22 +77,18 @@ void engine_option_value::link(engine_option_value **start, ...@@ -77,22 +77,18 @@ void engine_option_value::link(engine_option_value **start,
static bool report_wrong_value(THD *thd, const char *name, const char *val, static bool report_wrong_value(THD *thd, const char *name, const char *val,
my_bool suppress_warning) my_bool suppress_warning)
{ {
if (!(thd->variables.sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS)) if (suppress_warning)
return 0;
if (!(thd->variables.sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
!thd->slave_thread)
{ {
my_error(ER_BAD_OPTION_VALUE, MYF(0), val, name); my_error(ER_BAD_OPTION_VALUE, MYF(0), val, name);
return 1; return 1;
} }
/* push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_BAD_OPTION_VALUE,
We may need to suppress warnings to avoid duplicate messages ER(ER_BAD_OPTION_VALUE), val, name);
about the same option (option list is parsed more than once during
CREATE/ALTER table).
Errors are not suppressed, as they abort the execution on the first parsing.
*/
if (!suppress_warning)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_BAD_OPTION_VALUE,
ER(ER_BAD_OPTION_VALUE), val, name);
return 0; return 0;
} }
...@@ -100,23 +96,22 @@ static bool report_unknown_option(THD *thd, engine_option_value *val, ...@@ -100,23 +96,22 @@ static bool report_unknown_option(THD *thd, engine_option_value *val,
my_bool suppress_warning) my_bool suppress_warning)
{ {
DBUG_ENTER("report_unknown_option"); DBUG_ENTER("report_unknown_option");
if (val->parsed)
if (val->parsed || suppress_warning)
{ {
DBUG_PRINT("info", ("parsed => exiting")); DBUG_PRINT("info", ("parsed => exiting"));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
if (!(thd->variables.sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS)) if (!(thd->variables.sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
!thd->slave_thread)
{ {
my_error(ER_UNKNOWN_OPTION, MYF(0), val->name.str); my_error(ER_UNKNOWN_OPTION, MYF(0), val->name.str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!suppress_warning) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_OPTION, ER(ER_UNKNOWN_OPTION), val->name.str);
ER_UNKNOWN_OPTION,
ER(ER_UNKNOWN_OPTION),
val->name.str);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment