From ea19cbe732707918dd2ba673f11e1e5a57a6fdaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= <8471576+jfg956@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:21:45 -0400 Subject: [PATCH] Fix Bug#91737: Please log GTID_EXECUTED when running RESET MASTER. Bug#91737: https://bugs.mysql.com/bug.php?id=91737 --- sql/rpl_source.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sql/rpl_source.cc b/sql/rpl_source.cc index 10863cd87154..14255302d572 100644 --- a/sql/rpl_source.cc +++ b/sql/rpl_source.cc @@ -1198,6 +1198,7 @@ void kill_zombie_dump_threads(THD *thd) { */ bool reset_binary_logs_and_gtids(THD *thd, bool unlock_global_read_lock) { bool ret = false; + char *previous_gtid_executed = nullptr, *current_gtid_executed = nullptr; /* RESET BINARY LOGS AND GTIDS command should ignore 'read-only' and @@ -1220,6 +1221,8 @@ bool reset_binary_logs_and_gtids(THD *thd, bool unlock_global_read_lock) { goto end; } + gtid_state->get_executed_gtids()->to_string(&previous_gtid_executed); + if (mysql_bin_log.is_open()) { /* mysql_bin_log.reset_logs will delete the binary logs *and* clear @@ -1239,6 +1242,14 @@ bool reset_binary_logs_and_gtids(THD *thd, bool unlock_global_read_lock) { global_tsid_lock->unlock(); } + gtid_state->get_executed_gtids()->to_string(¤t_gtid_executed); + + LogErr(SYSTEM_LEVEL, ER_GTID_EXECUTED_WAS_UPDATED, previous_gtid_executed, + current_gtid_executed); + + my_free(current_gtid_executed); + my_free(previous_gtid_executed); + end: /* Unlock the global read lock (which was acquired by this