summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2023-05-16 16:33:07 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2023-05-16 16:33:07 +0200
commit008df8e4d689eaa205203923432d7696eae7e0f0 (patch)
tree0d193f6f5254b069bafec31e37ba4ecde10e6584
parent3dd4bad4b3c7681eba3b16af888e8e82d772e826 (diff)
downloadmariadb-git-knielsen_mdev25611.tar.gz
MDEV-25611: RESET MASTER still causes the server to hangknielsen_mdev25611
Testcase that reliably causes RESET MASTER to hang because it doesn't receive a binlog checkpoint notification. This testcase disables the InnoDB sync-the-redo-log-every-second, without doing that I don't see a hang. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
-rw-r--r--mysql-test/suite/binlog/t/binlog_mdev25611.test47
-rw-r--r--storage/innobase/srv/srv0srv.cc1
2 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/t/binlog_mdev25611.test b/mysql-test/suite/binlog/t/binlog_mdev25611.test
new file mode 100644
index 00000000000..598aae46073
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_mdev25611.test
@@ -0,0 +1,47 @@
+source include/have_innodb.inc;
+source include/have_log_bin.inc;
+source include/have_binlog_format_mixed.inc;
+
+# Error injection to minimize extra log flushing inside innodb.
+SET @old_dbug= @@global.DEBUG_DBUG;
+SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid";
+SET GLOBAL debug_dbug="+d,ib_background_sync_avoid";
+
+--connection default
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB STATS_PERSISTENT=0;
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t1 VALUES (3,1);
+
+connect (stop_purge,localhost,root,,);
+# This blocks purge due to old data being still visible.
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+--connection default
+INSERT INTO t1 VALUES (4,2);
+DELETE FROM t1 WHERE a in (1,2,3);
+
+# Rotate the binlog and wait for everything to settle down and latest binlog checkpoint to be done.
+FLUSH BINARY LOGS;
+--sleep 1
+#--source include/wait_for_binlog_checkpoint.inc
+
+# Now unblock the purge, and wait for some purge records to be written
+# to the redo log so the LSN is incremented but will not be synced to
+# disk until something else happens.
+--connection stop_purge
+ROLLBACK;
+--connection default
+--disconnect stop_purge
+
+--sleep 1
+
+# Now see if RESET MASTER will request and wait for a binlog checkpoint that is never reported.
+--echo *** Before RESET MASTER
+RESET MASTER;
+
+--echo *** After RESET MASTER
+
+--connection default
+DROP TABLE t1;
+SET GLOBAL debug_dbug= @old_dbug;
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 587b5718a24..f35709282d5 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1469,6 +1469,7 @@ innodb_flush_logs_at_trx_commit != 1 */
static void srv_sync_log_buffer_in_background()
{
time_t current_time = time(NULL);
+ DBUG_EXECUTE_IF("ib_background_sync_avoid", return;);
srv_main_thread_op_info = "flushing log";
if (difftime(current_time, srv_last_log_flush_time)