Commit 9cdf5c2b authored by Kristian Nielsen's avatar Kristian Nielsen

Merge branch '10.0' into 10.1

parents c8141f53 9088f26f
......@@ -101,6 +101,35 @@ if (!$annotate)
{
--echo # No Annotate_rows events should appear below
}
--echo ########################################################################
--echo # Ensure that a replication failure doesn't segfault - MDEV-7864
--echo ########################################################################
DELETE FROM t3 WHERE a=2;
connection master;
INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d;
INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10;
DELETE t3 FROM t3 INNER JOIN t5 ON t3.a=t5.a;
connection slave;
--echo ---- Wait until slave stops with an error ----
# Wait until the slave tries to run the query, fails with key not
# found error, and stops the SQL thread.
let $slave_sql_errno= 1032; # Can't find record
source include/wait_for_slave_sql_error.inc;
--let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
--replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
--disable_query_log
--eval SELECT "$err" as 'Last_SQL_Error (expected "Delete_rows_v1 event on table test1.t3; Can\'t find record in \'t3\'" error)'
--enable_query_log
call mtr.add_suppression("Slave: Can't find record in 't3' Error_code: 1032");
SET GLOBAL sql_slave_skip_counter=1;
START SLAVE;
connection master;
sync_slave_with_master;
--echo ########################################################################
FLUSH LOGS;
......
......@@ -18,4 +18,26 @@ show slave status;
select master_pos_wait('foo', 98);
master_pos_wait('foo', 98)
NULL
*** MDEV-7130: MASTER_POS_WAIT(log_name,log_pos,timeout,"connection_name") hangs, does not respect the timeout ***
include/stop_slave.inc
reset slave all;
change master 'my_slave' to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
set default_master_connection = 'my_slave';
include/start_slave.inc
# Call without connection name -- works (expected -1)
select master_pos_wait('master-bin.000001',1000000,1);
master_pos_wait('master-bin.000001',1000000,1)
-1
set default_master_connection = '';
# Call for non-existing anonymous connection -- works (expected NULL)
select master_pos_wait('master-bin.000001',1000000,1);
master_pos_wait('master-bin.000001',1000000,1)
NULL
# Call with a valid connection name -- hangs before MDEV-7130 fix (expected -1)
select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
master_pos_wait('master-bin.000001',1000000,1,"my_slave")
-1
STOP SLAVE 'my_slave';
RESET SLAVE 'my_slave' ALL;
change master to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
include/rpl_end.inc
......@@ -52,6 +52,20 @@ a b
# - DELETE xt1, t2 FROM <...>
# - INSERT INTO t5(b) VALUES <...> (3 instances)
########################################################################
# Ensure that a replication failure doesn't segfault - MDEV-7864
########################################################################
DELETE FROM t3 WHERE a=2;
INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d;
INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10;
DELETE t3 FROM t3 INNER JOIN t5 ON t3.a=t5.a;
---- Wait until slave stops with an error ----
include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error (expected "Delete_rows_v1 event on table test1.t3; Can't find record in 't3'" error)
Could not execute Delete_rows_v1 event on table test1.t3; Can't find record in 't3', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000002, end_log_pos END_LOG_POS
call mtr.add_suppression("Slave: Can't find record in 't3' Error_code: 1032");
SET GLOBAL sql_slave_skip_counter=1;
START SLAVE;
########################################################################
FLUSH LOGS;
show binlog events in 'slave-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
......@@ -131,6 +145,30 @@ slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås')
slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-25
slave-bin.000001 # Table_map 2 # table_id: # (test1.t3)
slave-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-25
slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d
slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-26
slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10
slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-27
slave-bin.000001 # Table_map 2 # table_id: # (mtr.test_suppressions)
slave-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
#
########################################################################
......
......@@ -44,6 +44,20 @@ a b
# EVENTS ON SLAVE
# No Annotate_rows events should appear below
########################################################################
# Ensure that a replication failure doesn't segfault - MDEV-7864
########################################################################
DELETE FROM t3 WHERE a=2;
INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d;
INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10;
DELETE t3 FROM t3 INNER JOIN t5 ON t3.a=t5.a;
---- Wait until slave stops with an error ----
include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error (expected "Delete_rows_v1 event on table test1.t3; Can't find record in 't3'" error)
Could not execute Delete_rows_v1 event on table test1.t3; Can't find record in 't3', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000002, end_log_pos END_LOG_POS
call mtr.add_suppression("Slave: Can't find record in 't3' Error_code: 1032");
SET GLOBAL sql_slave_skip_counter=1;
START SLAVE;
########################################################################
FLUSH LOGS;
show binlog events in 'slave-bin.000001' from <start_pos>;
Log_name Pos Event_type Server_id End_log_pos Info
......@@ -113,6 +127,28 @@ slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-24
slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-25
slave-bin.000001 # Table_map 2 # table_id: # (test1.t3)
slave-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-25
slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-26
slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: #
slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # COMMIT
slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-27
slave-bin.000001 # Table_map 2 # table_id: # (mtr.test_suppressions)
slave-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
#
########################################################################
......
......@@ -25,5 +25,36 @@ echo "*** must be NULL ***";
select master_pos_wait('foo', 98);
# End of 4.1 tests
--echo *** MDEV-7130: MASTER_POS_WAIT(log_name,log_pos,timeout,"connection_name") hangs, does not respect the timeout ***
--connection slave
--source include/stop_slave.inc
reset slave all;
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval change master 'my_slave' to master_port=$MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
set default_master_connection = 'my_slave';
--source include/start_slave.inc
--echo # Call without connection name -- works (expected -1)
select master_pos_wait('master-bin.000001',1000000,1);
set default_master_connection = '';
--echo # Call for non-existing anonymous connection -- works (expected NULL)
select master_pos_wait('master-bin.000001',1000000,1);
--echo # Call with a valid connection name -- hangs before MDEV-7130 fix (expected -1)
select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
STOP SLAVE 'my_slave';
RESET SLAVE 'my_slave' ALL;
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval change master to master_port=$MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
# End of 10.0 tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
......@@ -3932,11 +3932,11 @@ longlong Item_master_pos_wait::val_int()
}
#ifdef HAVE_REPLICATION
longlong pos = (ulong)args[1]->val_int();
longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
longlong timeout = (arg_count>=3) ? args[2]->val_int() : 0 ;
String connection_name_buff;
LEX_STRING connection_name;
Master_info *mi;
if (arg_count == 4)
if (arg_count >= 4)
{
String *con;
if (!(con= args[3]->val_str(&connection_name_buff)))
......
......@@ -4804,7 +4804,7 @@ err_during_init:
*/
thd->temporary_tables = 0; // remove tempation from destructor to close them
THD_CHECK_SENTRY(thd);
serial_rgi->thd= rli->sql_driver_thd= 0;
rli->sql_driver_thd= 0;
mysql_mutex_lock(&LOCK_thread_count);
THD_CHECK_SENTRY(thd);
thd->rgi_fake= thd->rgi_slave= NULL;
......
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