[Commits] Rev 2789: don't error out on unknown options in the in http://bazaar.launchpad.net/~maria-captains/maria/5.2/

At http://bazaar.launchpad.net/~maria-captains/maria/5.2/ ------------------------------------------------------------ revno: 2789 revision-id: sergii@pisem.net-20100512175605-tokirxxxj3b1csb7 parent: sergii@pisem.net-20100512161535-03sqksg8iz9e9nj5 committer: Sergei Golubchik <sergii@pisem.net> branch nick: 5.2 timestamp: Wed 2010-05-12 19:56:05 +0200 message: don't error out on unknown options in the replication thread or when opening a table === renamed file 'mysql-test/r/create_options.result' => 'mysql-test/r/table_options.result' === added file 'mysql-test/suite/rpl/r/rpl_table_options.result' --- a/mysql-test/suite/rpl/r/rpl_table_options.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/r/rpl_table_options.result 2010-05-12 17:56:05 +0000 @@ -0,0 +1,25 @@ +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; === added file 'mysql-test/suite/rpl/t/rpl_table_options-master.opt' --- a/mysql-test/suite/rpl/t/rpl_table_options-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/t/rpl_table_options-master.opt 2010-05-12 17:56:05 +0000 @@ -0,0 +1 @@ +$EXAMPLE_PLUGIN_OPT === added file 'mysql-test/suite/rpl/t/rpl_table_options.test' --- a/mysql-test/suite/rpl/t/rpl_table_options.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/t/rpl_table_options.test 2010-05-12 17:56:05 +0000 @@ -0,0 +1,31 @@ +--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; === renamed file 'mysql-test/t/create_options.test' => 'mysql-test/t/table_options.test' === modified file 'sql/create_options.cc' --- a/sql/create_options.cc 2010-05-12 16:15:35 +0000 +++ b/sql/create_options.cc 2010-05-12 17:56:05 +0000 @@ -77,22 +77,18 @@ void engine_option_value::link(engine_op static bool report_wrong_value(THD *thd, const char *name, const char *val, 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); return 1; } - /* - We may need to suppress warnings to avoid duplicate messages - 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); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_BAD_OPTION_VALUE, + ER(ER_BAD_OPTION_VALUE), val, name); return 0; } @@ -100,23 +96,22 @@ static bool report_unknown_option(THD *t my_bool suppress_warning) { DBUG_ENTER("report_unknown_option"); - if (val->parsed) + + if (val->parsed || suppress_warning) { DBUG_PRINT("info", ("parsed => exiting")); 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); DBUG_RETURN(TRUE); } - if (!suppress_warning) - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_UNKNOWN_OPTION, - ER(ER_UNKNOWN_OPTION), - val->name.str); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_UNKNOWN_OPTION, ER(ER_UNKNOWN_OPTION), val->name.str); DBUG_RETURN(FALSE); }
participants (1)
-
serg@askmonty.org