diff options
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result | 22 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test | 34 | ||||
-rw-r--r-- | sql-common/client.c | 4 | ||||
-rw-r--r-- | sql/net_serv.cc | 11 | ||||
-rw-r--r-- | sql/slave.cc | 12 |
5 files changed, 80 insertions, 3 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result b/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result index 3a80d5b5f31..71a8605c26c 100644 --- a/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result +++ b/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result @@ -19,4 +19,26 @@ a 1 connection master; DROP TABLE t1; +connection slave; +include/stop_slave.inc +connection master; +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES(1); +connection slave; +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET @@global.debug_dbug= 'd,simulate_error_on_packet_read'; +START SLAVE; +SET DEBUG_SYNC= 'now WAIT_FOR parked'; +SET @@GLOBAL.debug_dbug = @saved_dbug; +SET DEBUG_SYNC= 'now SIGNAL continue'; +SET DEBUG_SYNC= 'RESET'; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_start.inc +connection master; +include/sync_slave_sql_with_master.inc +SELECT * FROM t1; +a +1 +connection master; +DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test b/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test index d750d44ae71..9537a9016ad 100644 --- a/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test +++ b/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test @@ -14,6 +14,9 @@ # dump request command execution. # 2 - Start the slave. Observe that slave is able to reconnect post # temporary network write error. +# 3 - Simulate packet read error during dump request command execution. +# 4 - Start the slave. Observe that slave is able to reconnect post +# temporary network read error. # # ==== References ==== # @@ -57,4 +60,35 @@ SELECT * FROM t1; connection master; DROP TABLE t1; +connection slave; +--source include/stop_slave.inc + +connection master; +# Do an insert on master +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES(1); + +# Add a debug point and start the slave so that dump request fails. +connection slave; +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET @@global.debug_dbug= 'd,simulate_error_on_packet_read'; + +START SLAVE; +SET DEBUG_SYNC= 'now WAIT_FOR parked'; +SET @@GLOBAL.debug_dbug = @saved_dbug; +SET DEBUG_SYNC= 'now SIGNAL continue'; +SET DEBUG_SYNC= 'RESET'; + +--source include/wait_for_slave_io_to_start.inc +--source include/wait_for_slave_sql_to_start.inc + +# Sync the slave and verify that slave has caught up with the master. +connection master; +--source include/sync_slave_sql_with_master.inc +SELECT * FROM t1; + +# Cleanup +connection master; +DROP TABLE t1; + --source include/rpl_end.inc diff --git a/sql-common/client.c b/sql-common/client.c index ff36b757957..6c50cabe8fa 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -721,7 +721,9 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command, set_mysql_error(mysql, CR_NET_PACKET_TOO_LARGE, unknown_sqlstate); goto end; } - if (net->last_errno == ER_NET_ERROR_ON_WRITE && command == COM_BINLOG_DUMP) + if ((net->last_errno == ER_NET_ERROR_ON_WRITE || + net->last_errno == ER_NET_READ_ERROR ) + && command == COM_BINLOG_DUMP) goto end; end_server(mysql); if (mysql_reconnect(mysql) || stmt_skip) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 076d26dee3d..c315dc540c3 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -498,6 +498,17 @@ net_write_command(NET *net,uchar command, DBUG_RETURN(true); } };); + DBUG_EXECUTE_IF("simulate_error_on_packet_read", + { + if (command == COM_BINLOG_DUMP) + { + net->last_errno = ER_NET_READ_ERROR; + DBUG_ASSERT(!debug_sync_set_action( + (THD *)net->thd, + STRING_WITH_LEN("now SIGNAL parked WAIT_FOR continue"))); + DBUG_RETURN(true); + } + };); MYSQL_NET_WRITE_START(length); buff[4]=command; /* For first packet */ diff --git a/sql/slave.cc b/sql/slave.cc index 761fdbe807a..69fe5b13265 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3199,8 +3199,16 @@ static int request_dump(THD *thd, MYSQL* mysql, Master_info* mi, now we just fill up the error log :-) */ if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED || - mysql_errno(mysql) == ER_NET_ERROR_ON_WRITE) - *suppress_warnings= TRUE; // Suppress reconnect warning + mysql_errno(mysql) == ER_NET_ERROR_ON_WRITE || + mysql_errno(mysql) == ER_NET_READ_ERROR) + { + *suppress_warnings= TRUE; // Suppress reconnect warning on slave + + if (global_system_variables.log_warnings > 2) + sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs", + mysql_errno(mysql), mysql_error(mysql), + mi->connect_retry); + } else sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs", mysql_errno(mysql), mysql_error(mysql), |