summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2021-08-09 16:26:21 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2021-08-17 11:51:43 +0530
commite727b9151ca58df8169fac9f14ebc3e88427e0bf (patch)
tree091491a466b07cea950af2d1908b80ead18f5f02
parent255313048ca00c48fe78250014570034475a9178 (diff)
downloadmariadb-git-bb-10.5-sujatha.tar.gz
MDEV-23372: rpl.rpl_skip_replication still fails in buildbot with an extrabb-10.5-sujatha
warning Problem: ======== [Warning] Aborted connection 18 to db: 'unconnected' user: 'root' host: 'localhost' (Got an error reading communication packets) [Note] Start binlog_dump to slave_server(2), pos(, 4), using_gtid(0), gtid('') [Warning] Aborted connection 17 to db: 'unconnected' user: 'root' host: 'localhost' (A slave with the same server_uuid/server_id as this slave has co) [Warning] Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process theml Analysis: ========= Issue is similar MDEV-14203. MDEV-14203 fix addressed network write error issue now the same needs to be implemented for network read error. Fix: === Upon network read error donot attempt reconnect, proceed to master-slave handshake. This ensures that master is aware of slave's capability to use checksums.
-rw-r--r--mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result22
-rw-r--r--mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test34
-rw-r--r--sql-common/client.c4
-rw-r--r--sql/net_serv.cc11
-rw-r--r--sql/slave.cc12
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 f314c03944b..6e1ed75e7aa 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -512,7 +512,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 1d2409f16cf..d409fe52dbd 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -518,6 +518,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 1da030084ef..40531105b6c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3576,8 +3576,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),