List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:November 29 2010 4:49am
Subject:Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183
View as plain text  
Hi Libing,

Patch approved!

Li-Bing.Song@stripped wrote:
> #At file:///home/anders/Work/bzrwork/wt4/mysql-trunk-bugfixing/ based on
> revid:dao-gang.qu@stripped
> 
>  3350 Li-Bing.Song@stripped	2010-11-23
>       Bug#48183 statements using fulltext parser plugins should be marked unsafe
>       
>       Any use of plugins that could affect rows in a table should be marked unsafe
>       because it cannot be determined that the statement will have the same effect
>       on the slave. For example, UDFs are currently marked unsafe.  However, use of
>       fulltext parser plugins is currently not marked as unsafe.
>       
>       After this patch, any statement which uses fulltext parser plugins is marked
>       unsafe.
>      @ mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
>         Add SIMPLE_PARSER_OPT option.
>      @ mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
>         Add test for this bug.
>      @ sql/share/errmsg-utf8.txt
>         Add ER_BINLOG_UNSAFE_PLUGIN.
>      @ sql/sql_base.cc
>         Mark current statement is unsafe when setup fulltext parsers.
>      @ sql/sql_class.h
>         Add auxiliary function to set binlog_unsafe_warning_flags.
>      @ sql/sql_lex.cc
>         Initilaize unsafe plugin error message.
>      @ sql/sql_lex.h
>         Add unsafe type BINLOG_STMT_UNSAFE_PLUGIN.
> 
>     modified:
>       mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
>       mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
>       mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
>       sql/share/errmsg-utf8.txt
>       sql/sql_base.cc
>       sql/sql_class.h
>       sql/sql_lex.cc
>       sql/sql_lex.h
> === modified file 'mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result'
> --- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result	2010-08-10 11:58:46
> +0000
> +++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result	2010-11-23 09:19:35
> +0000
> @@ -94,3 +94,21 @@ Note	1592	Unsafe statement written to th
>  DROP FUNCTION sf_bug50192;
>  DROP TRIGGER tr_bug50192;
>  DROP TABLE t1, t2;
> +
> +# BUG#48183 statements using fulltext parser plugins should be marked unsafe
> +INSTALL PLUGIN simple_parser SONAME 'mypluglib.so';
> +
> +CREATE TABLE t1 (a TEXT, FULLTEXT(a) WITH PARSER simple_parser);
> +CREATE TABLE t2 (a TEXT, FULLTEXT(a));
> +CREATE TABLE t3 (a TEXT);
> +
> +# It should generate an unsafe warning
> +INSERT INTO t3 SELECT * FROM t1 WHERE MATCH (a) AGAINST ('test');
> +Warnings:
> +Note	1592	Unsafe statement written to the binary log using statement format since
> BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a plugin which may not
> return the same value on the slave.
> +
> +# It should not generate an unsafe warning
> +INSERT INTO t3 SELECT * FROM t2 WHERE MATCH (a) AGAINST ('test');
> +
> +DROP TABLE t1, t2, t3;
> +UNINSTALL PLUGIN simple_parser;
> 
> === modified file 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt'
> --- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt	2009-07-31
> 13:00:35 +0000
> +++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt	2010-11-23
> 09:19:35 +0000
> @@ -1 +1,2 @@
>  --binlog-ignore-db=b42851 --log-error
> +$SIMPLE_PARSER_OPT
> 
> === modified file 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test'
> --- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test	2010-08-10 11:58:46
> +0000
> +++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test	2010-11-23 09:19:35
> +0000
> @@ -168,3 +168,25 @@ SHOW WARNINGS;
>  DROP FUNCTION sf_bug50192;
>  DROP TRIGGER tr_bug50192;
>  DROP TABLE t1, t2;
> +
> +--echo
> +--echo # BUG#48183 statements using fulltext parser plugins should be marked unsafe
> +--source include/have_simple_parser.inc
> +
> +INSTALL PLUGIN simple_parser SONAME 'mypluglib.so';
> +
> +--echo
> +CREATE TABLE t1 (a TEXT, FULLTEXT(a) WITH PARSER simple_parser);
> +CREATE TABLE t2 (a TEXT, FULLTEXT(a));
> +CREATE TABLE t3 (a TEXT);
> +
> +--echo
> +--echo # It should generate an unsafe warning
> +INSERT INTO t3 SELECT * FROM t1 WHERE MATCH (a) AGAINST ('test');
> +--echo
> +--echo # It should not generate an unsafe warning
> +INSERT INTO t3 SELECT * FROM t2 WHERE MATCH (a) AGAINST ('test');
> +
> +--echo
> +DROP TABLE t1, t2, t3;
> +UNINSTALL PLUGIN simple_parser;
> \ No newline at end of file
> 
> === modified file 'sql/share/errmsg-utf8.txt'
> --- a/sql/share/errmsg-utf8.txt	2010-10-29 09:43:58 +0000
> +++ b/sql/share/errmsg-utf8.txt	2010-11-23 09:19:35 +0000
> @@ -6439,3 +6439,6 @@ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MA
>  ER_PARTITION_EXCHANGE_FOREIGN_KEY
>    eng "Table to exchange with partition has foreign key references: '%-.64s'"
>    swe "Tabellen att byta ut mot partition har foreign key referenser: '%-.64s'"
> +
> +ER_BINLOG_UNSAFE_PLUGIN
> +  eng "Statement is unsafe because it uses a plugin which may not return the same
> value on the slave."
> 
> === modified file 'sql/sql_base.cc'
> --- a/sql/sql_base.cc	2010-10-25 12:13:13 +0000
> +++ b/sql/sql_base.cc	2010-11-23 09:19:35 +0000
> @@ -8791,7 +8791,7 @@ int setup_ftfuncs(SELECT_LEX *select_lex
>    List_iterator<Item_func_match> li(*(select_lex->ftfunc_list)),
>                                   lj(*(select_lex->ftfunc_list));
>    Item_func_match *ftf, *ftf2;
> -
> +  THD *thd= current_thd;
>    while ((ftf=li++))
>    {
>      if (ftf->fix_index())
> @@ -8802,6 +8802,12 @@ int setup_ftfuncs(SELECT_LEX *select_lex
>        if (ftf->eq(ftf2,1) && !ftf2->master)
>          ftf2->master=ftf;
>      }
> +
> +    /* Just like UDF, we don't know if plugin's funtions will output same value
> +       on both master and slave, So the statement is marked unsafe.
> +    */
> +    if (ftf->table->key_info[ftf->key].parser)
> +      thd->set_binlog_unsafe_warning_flags(LEX::BINLOG_STMT_UNSAFE_PLUGIN);
>    }
>  
>    return 0;
> 
> === modified file 'sql/sql_class.h'
> --- a/sql/sql_class.h	2010-11-05 08:13:09 +0000
> +++ b/sql/sql_class.h	2010-11-23 09:19:35 +0000
> @@ -1624,6 +1624,10 @@ private:
>    */
>    uint binlog_table_maps;
>  public:
> +  void set_binlog_unsafe_warning_flags(LEX::enum_binlog_stmt_unsafe unsafe_type)
> +  {
> +    binlog_unsafe_warning_flags|= (1U << unsafe_type);
> +  }
>    void issue_unsafe_warnings();
>  
>    uint get_binlog_table_maps() const {
> 
> === modified file 'sql/sql_lex.cc'
> --- a/sql/sql_lex.cc	2010-11-10 11:26:45 +0000
> +++ b/sql/sql_lex.cc	2010-11-23 09:19:35 +0000
> @@ -58,7 +58,8 @@ Query_tables_list::binlog_stmt_unsafe_er
>    ER_BINLOG_UNSAFE_SYSTEM_FUNCTION,
>    ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS,
>    ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE,
> -  ER_BINLOG_UNSAFE_MIXED_STATEMENT
> +  ER_BINLOG_UNSAFE_MIXED_STATEMENT,
> +  ER_BINLOG_UNSAFE_PLUGIN,
>  };
>  
> 
> 
> === modified file 'sql/sql_lex.h'
> --- a/sql/sql_lex.h	2010-11-10 11:26:45 +0000
> +++ b/sql/sql_lex.h	2010-11-23 09:19:35 +0000
> @@ -1189,6 +1189,11 @@ public:
>      */
>      BINLOG_STMT_UNSAFE_MIXED_STATEMENT,
>  
> +    /**
> +       Using a plugin is unsafe.
> +    */
> +    BINLOG_STMT_UNSAFE_PLUGIN,
> +
>      /* The last element of this enumeration type. */
>      BINLOG_STMT_UNSAFE_COUNT
>    };
> 
> text/bzr-bundle 类型 附件
> (bzr/li-bing.song@stripped)
> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: li-bing.song@stripped
> # target_branch: file:///home/anders/Work/bzrwork/wt4/mysql-trunk-\
> #   bugfixing/
> # testament_sha1: 6c041ba3fb0c9a44869694c8a36497945361e55b
> # timestamp: 2010-11-23 17:19:51 +0800
> # base_revision_id: dao-gang.qu@stripped\
> #   y7r78x9qcy9sh1ii
> # 
> # Begin bundle
> IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZIHhc8AB3ZfgFgwXPf//3/3
> 3sq////+YA7uaV9Ou+9ylQAB0GkNSaNYrQDTRewenm3QHNhtgMkQaJk0R6T0mYhqND1NNpNNAADQ
> AANAqlTJtTJkmmE1PEajJ6jaTTJoNANGIwgNABxkaZMTQZMmE0yBkNAaA0yaGAE0BhIiIEnppGEp
> +mU1NNlHo00T1GmmJo0xMCDQyaDalU9J6T9QymE9E9ENHqYQHogaDRoAGIDIEkgRoCZNGQAjQmjS
> Y1JNPU8iaAxGBNPQ2T0IUjit3Jo21FTiocyhq892aWBaVlUR6FCwgFYeVkM9s/v0Z/O+d7DKeb/n
> 2ubkz6cPFst1cCqyGalfS/XCiIqn0Re9t+FlMKBEP1g83cqolJK/BrgXr2ZqYuLd/TvsitHEXZdl
> fVpREWyNm1DDijjaTiwr6t6THPI8+oahqQNttsbbBsfP7Uo1O7bsknjgbsBy5bms0nPMa3Y5KubI
> tdGEsb9GflDed85DdzBzBlS4kUZzK5DOXextWWUuZaN9GtfllbDC2+BtX6TK+tDewqospB+/DWjW
> Nl8gW2v5W5l8JnMVP6+M0vZEK3pxRBzwc/7KzuBSQUg5VykBMU5bF5yQ0SxA6tnRmxvVKh3z2DIs
> ouJzlB2FuPWMGbSD2BBxYaADPGjDQiMeIkpULCIkJUE+bDK42WrhdNxAHUfDocRsX56qUyUKQNW0
> tPxQQFWMIr5FQ4UqSqID4bXr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49h4Z0roYJyBkyRZuN
> 3m5BvnfxN9yqQaYmAU5hejAoSX0DjbpLVxVZMK0qhJnzZ4xVKJ5eY7643kEwMptUn07y5uaJbbpR
> snNJBSg1B4giPPFFyOxehcGgqf0sdT6Jl4qhA/eg95AfBMD2X2qDRIgBqPqYFgfasV1r60kdlZ/A
> Bk9EREREREhsUImVSIURCiIUOi2I4xHC0jFA5WgSvSLiC1USC1iOAzyPX2SLnvNhAKFrvgoGWcwD
> GI8FG5hffYGWJHWQMgWgwHsaWXYkwKwCadxn2gvqMlPyNjg1qplHF8EjrD5sOus67gxM09hQAGpN
> aLC8EX2pUH56fzekfgEZeq1euzwOl3BZoXYa0kOSILFtrKphFR7Kxc609aIsyKw0Xivg4N35fQeh
> dKelH0rag5Up1A0hRryAyaDrZCApdZdByASl0gaJV3aSjFAL4on3jtNgtGaErUSJXHGy/awnAK1O
> 5e1YGQFgMgzTrixwqd66r3UlGWa+Jcn7QKhG4pKl+KpAj2771ZXuBEhWgyAatROaxHnAee/otyoU
> yB38Fq9ziCLVzLlVesjarnCz9ARjTJZiKBrzYYga9a6yXDs3+BdyRThQkJIHhc8=
> 
> 


Thread
bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183Li-Bing.Song23 Nov
  • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183He Zhenxing29 Nov
  • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350)Bug#48183Sergey Vojtovich29 Nov
    • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183Libing Song1 Dec
      • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350)Bug#48183Sergey Vojtovich1 Dec
        • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183Libing Song2 Dec
          • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350)Bug#48183Sergey Vojtovich2 Dec
            • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183Alfranio Correia2 Dec
              • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350)Bug#48183Sergey Vojtovich2 Dec
            • Re: bzr commit into mysql-trunk branch (Li-Bing.Song:3350) Bug#48183Libing Song3 Dec