summaryrefslogtreecommitdiff
path: root/sql/sql_reload.cc
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-05-20 22:11:07 -0600
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-05-20 22:11:07 -0600
commitb7bbeafd8467e5dc4d631fdbfc277f060157d278 (patch)
treee450c3fe5d4191aa5a6008ca712895657c5fd37d /sql/sql_reload.cc
parent08b6fd93957280c1b3e12c30ead1b6b90a7dff26 (diff)
downloadmariadb-git-10.4-MDEV-20215.tar.gz
MDEV-20215: binlog.show_concurrent_rotate failed in buildbot with wrong result10.4-MDEV-20215
Problem: ======= A race condition exists between two connections to get the binary logs lock, where the first connection tries to SHOW BINARY LOGS and uses the lock to obtain all logs, and the second connection uses the lock in RESET MASTER to purge the logs and restart the rotation. Solution: ======= Where it is expected to have some amount of stale data in the SHOW BINARY LOGS call, limit it to only the most current binary log file size. More specifically, after going through the cached file list (which can take up to 20 seconds), check to see if any new files have been created in the directory. If so, analyze each new created file. Additionally, the check for purged files only checks file name, so to enhance the logic here, additionally consider timestamp to reduce wasted time on file stats.
Diffstat (limited to 'sql/sql_reload.cc')
-rw-r--r--sql/sql_reload.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 76fb9819fd5..d57db51a5f6 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -150,6 +150,9 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
DYNAMIC_ARRAY *drop_gtid_domain=
(thd && (thd->lex->delete_gtid_domain.elements > 0)) ?
&thd->lex->delete_gtid_domain : NULL;
+
+ DEBUG_SYNC(thd, "at_flush_pre_rotate_and_purge");
+
if (mysql_bin_log.rotate_and_purge(true, drop_gtid_domain))
*write_to_binlog= -1;