From: Nuno Carvalho Date: May 8 2012 5:13pm Subject: bzr push into mysql-trunk branch (nuno.carvalho:3800 to 3801) Bug#13810456 List-Archive: http://lists.mysql.com/commits/143771 X-Bug: 13810456 Message-Id: <201205081713.q48HDn7f030892@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3801 Nuno Carvalho 2012-05-08 BUG#13810456: GTID: UNTIL_SQL_BEFORE_GTID DOES NOT WORK Fixed parser verification on START SLAVE UNTIL SQL_*_GTID and position conditions. Added reset method to struct_slave_connection to allways clean previous values before parsing a new START SLAVE statement. modified: mysql-test/suite/rpl/r/rpl_gtid_sql_until_before_after.result mysql-test/suite/rpl/t/rpl_gtid_sql_until_before_after.test sql/rpl_slave.cc sql/sql_lex.cc sql/sql_lex.h sql/sql_yacc.yy 3800 Venkata Sidagam 2012-05-08 [merge] Null merge from mysql-5.5 to mysql-trunk === modified file 'mysql-test/suite/rpl/r/rpl_gtid_sql_until_before_after.result' --- a/mysql-test/suite/rpl/r/rpl_gtid_sql_until_before_after.result 2012-03-29 17:53:11 +0000 +++ b/mysql-test/suite/rpl/r/rpl_gtid_sql_until_before_after.result 2012-05-08 17:11:38 +0000 @@ -18,15 +18,30 @@ INSERT INTO t1 VALUES(8); INSERT INTO t1 VALUES(9); INSERT INTO t1 VALUES(10); [connection slave] +START SLAVE UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100; +ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL +START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100; +ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL +START SLAVE IO_THREAD UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100; +ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL +START SLAVE FOO UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5"; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOO UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5"' at line 1 +Check that START SLAVE IO_THREAD UNTIL ... maintains old behaviour, condition is ignored. +START SLAVE IO_THREAD UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5"; +Warnings: +Note 1279 SQL thread is not to be started so UNTIL options are ignored +Wait until IO Thread reads all master binlog and stop slave. +include/wait_for_slave_param.inc [Retrieved_Gtid_Set] +include/stop_slave_io.inc SQL thread must stop *before* INSERT 4 -START SLAVE UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5"; +START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:4-5"; include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; c1 2 3 SQL thread must stop *after* INSERT 5 -START SLAVE UNTIL SQL_AFTER_GTIDS= "MASTER_UUID:4-5"; +START SLAVE SQL_THREAD UNTIL SQL_AFTER_GTIDS= "MASTER_UUID:4-5"; include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; c1 @@ -35,7 +50,7 @@ c1 4 5 SQL thread must stop *before* INSERT 6 -START SLAVE UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:2-7"; +START SLAVE SQL_THREAD, IO_THREAD UNTIL SQL_BEFORE_GTIDS= "MASTER_UUID:2-7"; include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; c1 @@ -45,7 +60,7 @@ c1 5 SQL thread must stop *after* INSERT 5 1-5 are already applied so it will stop immediately -START SLAVE UNTIL SQL_AFTER_GTIDS= "MASTER_UUID:1-5"; +START SLAVE SQL_THREAD, IO_THREAD UNTIL SQL_AFTER_GTIDS= "MASTER_UUID:1-5"; include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; c1 @@ -95,7 +110,7 @@ c1 8 9 Sync slave with master -include/start_slave_sql.inc +include/start_slave.inc SELECT SQL_THREAD_WAIT_AFTER_GTIDS('MASTER_UUID:10', 300); SELECT * FROM t1; c1 === modified file 'mysql-test/suite/rpl/t/rpl_gtid_sql_until_before_after.test' --- a/mysql-test/suite/rpl/t/rpl_gtid_sql_until_before_after.test 2012-03-27 08:43:25 +0000 +++ b/mysql-test/suite/rpl/t/rpl_gtid_sql_until_before_after.test 2012-05-08 17:11:38 +0000 @@ -32,11 +32,53 @@ while ($i != 11) --connection slave --echo [connection slave] + +# Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS +--disable_query_log +--replace_result $master_uuid MASTER_UUID +--enable_query_log +--error ER_BAD_SLAVE_UNTIL_COND +--eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100 + +# Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS +--disable_query_log +--replace_result $master_uuid MASTER_UUID +--enable_query_log +--error ER_BAD_SLAVE_UNTIL_COND +--eval START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100 + +# Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS +--disable_query_log +--replace_result $master_uuid MASTER_UUID +--enable_query_log +--error ER_BAD_SLAVE_UNTIL_COND +--eval START SLAVE IO_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100 + +# Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS +--disable_query_log +--replace_result $master_uuid MASTER_UUID +--enable_query_log +--error ER_PARSE_ERROR +--eval START SLAVE FOO UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" + +# UNTIL GTID +--echo Check that START SLAVE IO_THREAD UNTIL ... maintains old behaviour, condition is ignored. +--disable_query_log +--replace_result $master_uuid MASTER_UUID +--enable_query_log +--eval START SLAVE IO_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" + +--echo Wait until IO Thread reads all master binlog and stop slave. +--let $slave_param= Retrieved_Gtid_Set +--let $slave_param_value= $master_uuid:1-10 +--source include/wait_for_slave_param.inc +--source include/stop_slave_io.inc + --echo SQL thread must stop *before* INSERT 4 --disable_query_log --replace_result $master_uuid MASTER_UUID --enable_query_log ---eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" +--eval START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" --source include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; @@ -44,7 +86,7 @@ SELECT * FROM t1; --disable_query_log --replace_result $master_uuid MASTER_UUID --enable_query_log ---eval START SLAVE UNTIL SQL_AFTER_GTIDS= "$master_uuid:4-5" +--eval START SLAVE SQL_THREAD UNTIL SQL_AFTER_GTIDS= "$master_uuid:4-5" --source include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; @@ -52,7 +94,7 @@ SELECT * FROM t1; --disable_query_log --replace_result $master_uuid MASTER_UUID --enable_query_log ---eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:2-7" +--eval START SLAVE SQL_THREAD, IO_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:2-7" --source include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; @@ -61,7 +103,7 @@ SELECT * FROM t1; --disable_query_log --replace_result $master_uuid MASTER_UUID --enable_query_log ---eval START SLAVE UNTIL SQL_AFTER_GTIDS= "$master_uuid:1-5" +--eval START SLAVE SQL_THREAD, IO_THREAD UNTIL SQL_AFTER_GTIDS= "$master_uuid:1-5" --source include/wait_for_slave_sql_to_stop.inc SELECT * FROM t1; @@ -92,7 +134,7 @@ SELECT * FROM t1; SELECT * FROM t1; --echo Sync slave with master ---source include/start_slave_sql.inc +--source include/start_slave.inc --disable_query_log --replace_result $master_uuid MASTER_UUID --enable_query_log === modified file 'sql/rpl_slave.cc' --- a/sql/rpl_slave.cc 2012-05-03 08:11:43 +0000 +++ b/sql/rpl_slave.cc 2012-05-08 17:11:38 +0000 @@ -7614,7 +7614,7 @@ int start_slave(THD* thd , Master_info* "not retry the transaction and will stop."); } } - else if (thd->lex->mi.pos || thd->lex->mi.relay_log_pos) + else if (thd->lex->mi.pos || thd->lex->mi.relay_log_pos || thd->lex->mi.gtid) push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED, ER(ER_UNTIL_COND_IGNORED)); === modified file 'sql/sql_lex.cc' --- a/sql/sql_lex.cc 2012-04-21 12:11:15 +0000 +++ b/sql/sql_lex.cc 2012-05-08 17:11:38 +0000 @@ -173,6 +173,16 @@ st_parsing_options::reset() allows_derived= TRUE; } +/** + Cleans slave connection info. +*/ +void struct_slave_connection::reset() +{ + user= 0; + password= 0; + plugin_auth= 0; + plugin_dir= 0; +} /** Perform initialization of Lex_input_stream instance. === modified file 'sql/sql_lex.h' --- a/sql/sql_lex.h 2012-04-21 12:14:15 +0000 +++ b/sql/sql_lex.h 2012-05-08 17:11:38 +0000 @@ -986,6 +986,8 @@ typedef struct struct_slave_connection char *password; char *plugin_auth; char *plugin_dir; + + void reset(); } LEX_SLAVE_CONNECTION; struct st_sp_chistics === modified file 'sql/sql_yacc.yy' --- a/sql/sql_yacc.yy 2012-04-30 07:13:31 +0000 +++ b/sql/sql_yacc.yy 2012-05-08 17:11:38 +0000 @@ -7580,6 +7580,8 @@ slave: START_SYM SLAVE opt_slave_thread_option_list { LEX *lex=Lex; + /* Clean previous slave connection values */ + lex->slave_connection.reset(); lex->sql_command = SQLCOM_SLAVE_START; lex->type = 0; /* We'll use mi structure for UNTIL options */ @@ -7673,7 +7675,7 @@ slave_connection_opts: slave_user_name_opt: { - Lex->slave_connection.user= 0; + /* empty */ } | USER EQ TEXT_STRING_sys { @@ -7683,7 +7685,7 @@ slave_user_name_opt: slave_user_pass_opt: { - Lex->slave_connection.password= 0; + /* empty */ } | PASSWORD EQ TEXT_STRING_sys { @@ -7692,7 +7694,7 @@ slave_user_pass_opt: slave_plugin_auth_opt: { - Lex->slave_connection.plugin_auth= 0; + /* empty */ } | DEFAULT_AUTH_SYM EQ TEXT_STRING_sys { @@ -7702,7 +7704,7 @@ slave_plugin_auth_opt: slave_plugin_dir_opt: { - Lex->slave_connection.plugin_dir= 0; + /* empty */ } | PLUGIN_DIR_SYM EQ TEXT_STRING_sys { @@ -7749,7 +7751,8 @@ slave_until: { LEX *lex=Lex; if (((lex->mi.log_file_name || lex->mi.pos) && - (lex->mi.relay_log_name || lex->mi.relay_log_pos) && + lex->mi.gtid) || + ((lex->mi.relay_log_name || lex->mi.relay_log_pos) && lex->mi.gtid) || !((lex->mi.log_file_name && lex->mi.pos) || (lex->mi.relay_log_name && lex->mi.relay_log_pos) || No bundle (reason: useless for push emails).