summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/binlog/r/purge_not_deleting_on_concurrent_reads.result23
-rw-r--r--mysql-test/suite/binlog/t/purge_not_deleting_on_concurrent_reads.test30
-rw-r--r--sql/sql_repl.cc2
3 files changed, 55 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/purge_not_deleting_on_concurrent_reads.result b/mysql-test/suite/binlog/r/purge_not_deleting_on_concurrent_reads.result
new file mode 100644
index 00000000000..84890dd2285
--- /dev/null
+++ b/mysql-test/suite/binlog/r/purge_not_deleting_on_concurrent_reads.result
@@ -0,0 +1,23 @@
+connect con1,localhost,root,,;
+FLUSH LOGS;
+FLUSH LOGS;
+FLUSH LOGS;
+PURGE BINARY LOGS to 'master-bin.000004';
+FLUSH LOGS;
+connect con2,localhost,root,,;
+SET DEBUG_SYNC= "show_binlog_events_got_linfo WAIT_FOR purge_finished";
+SHOW BINLOG EVENTS;
+connection con1;
+PURGE BINARY LOGS to 'master-bin.000005';
+SET DEBUG_SYNC= "now SIGNAL purge_finished";
+connection con2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000004 4 Format_desc 1 256 Server ver: 10.3.30-MariaDB-debug-log, Binlog ver: 4
+master-bin.000004 256 Gtid_list 1 285 []
+master-bin.000004 285 Binlog_checkpoint 1 329 master-bin.000003
+master-bin.000004 329 Binlog_checkpoint 1 373 master-bin.000004
+master-bin.000004 373 Rotate 1 421 master-bin.000005;pos=4
+# -- Index File:
+./master-bin.000004
+./master-bin.000005
+SET debug_sync = 'reset';
diff --git a/mysql-test/suite/binlog/t/purge_not_deleting_on_concurrent_reads.test b/mysql-test/suite/binlog/t/purge_not_deleting_on_concurrent_reads.test
new file mode 100644
index 00000000000..c5c8b869569
--- /dev/null
+++ b/mysql-test/suite/binlog/t/purge_not_deleting_on_concurrent_reads.test
@@ -0,0 +1,30 @@
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--source include/have_binlog_format_row.inc
+
+connect(con1,localhost,root,,);
+FLUSH LOGS;
+FLUSH LOGS;
+FLUSH LOGS;
+PURGE BINARY LOGS to 'master-bin.000004';
+FLUSH LOGS;
+
+connect(con2,localhost,root,,);
+SET DEBUG_SYNC= "show_binlog_events_got_linfo WAIT_FOR purge_finished";
+--send SHOW BINLOG EVENTS
+
+--connection con1
+PURGE BINARY LOGS to 'master-bin.000005';
+SET DEBUG_SYNC= "now SIGNAL purge_finished";
+
+--connection con2
+--reap
+
+--let $datadir= `SELECT @@datadir`
+--let $index=$datadir/mysqld-bin.index
+--echo # -- Index File:
+--cat_file $index
+
+
+SET debug_sync = 'reset'; \ No newline at end of file
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 389346e389d..6c16e5b6c46 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -4015,6 +4015,8 @@ bool mysql_show_binlog_events(THD* thd)
thd->current_linfo= &linfo;
+ DEBUG_SYNC(thd, "show_binlog_events_got_linfo");
+
if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0)
goto err;