summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-08-19 12:25:00 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-08-19 12:25:00 +0300
commitf3fcf5f45c9c09242bfb8762a88c26238458e4c2 (patch)
tree914f1a5d9bd38b9f9d09d0c39306c80c00e21842 /sql/sql_repl.cc
parent475f69b98587c2a0842e3fcbfe515e4362ded973 (diff)
parent17980e35fafdf0b05c89c11ecafbea96e1cfc5e5 (diff)
downloadmariadb-git-f3fcf5f45c9c09242bfb8762a88c26238458e4c2.tar.gz
Merge 10.5 to 10.6
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index b187c26eee7..7bcff12a735 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -4387,6 +4387,7 @@ bool show_binlogs(THD* thd)
Protocol *protocol= thd->protocol;
uint retry_count= 0;
size_t cur_dir_len;
+ uint64 expected_reset_masters;
DBUG_ENTER("show_binlogs");
if (!mysql_bin_log.is_open())
@@ -4411,6 +4412,7 @@ retry:
mysql_mutex_lock(mysql_bin_log.get_log_lock());
mysql_bin_log.lock_index();
mysql_bin_log.raw_get_current_log(&cur);
+ expected_reset_masters= mysql_bin_log.get_reset_master_count();
mysql_mutex_unlock(mysql_bin_log.get_log_lock());
/* The following call unlocks lock_index */
@@ -4431,6 +4433,16 @@ retry:
cur_link->name.str+= dir_len;
cur_link->name.length-= dir_len;
+ if (mysql_bin_log.get_reset_master_count() > expected_reset_masters)
+ {
+ /*
+ Reset master was called after we cached filenames.
+ Reinitialize the cache.
+ */
+ free_root(&mem_root, MYF(MY_MARK_BLOCKS_FREE));
+ goto retry;
+ }
+
if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length)))
cur_link->size= cur.pos; /* The active log, use the active position */
else