summaryrefslogtreecommitdiff
path: root/sql/log.h
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-10-13 07:31:32 -0600
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-10-18 10:43:51 -0600
commit2291f8ef73489fb8ed79768484df1ee4db3583a7 (patch)
tree2243d2e502e7bc615ae29e60fae6c47e563ec324 /sql/log.h
parent5f63f5dc60a48105d739f606cbf0a575925029d1 (diff)
downloadmariadb-git-2291f8ef73489fb8ed79768484df1ee4db3583a7.tar.gz
MDEV-25284: Assertion `info->type == READ_CACHE || info->type == WRITE_CACHE' failedbb-10.2-MDEV-25284
Problem: ======== This patch addresses two issues. First, if a CHANGE MASTER command is issued and an error happens while locating the replica’s relay logs, the logs can be put into an invalid state where future updates fail and future CHANGE MASTER calls crash the server. More specifically, right before a replica purges the relay logs (part of the `CHANGE MASTER TO` logic), the relay log is temporarily closed with state LOG_TO_BE_OPENED. If the server errors in-between the temporary log closure and purge, i.e. during the function find_log_pos, the log should be closed. MDEV-25284 reveals the log is not properly closed. Second, upon issuing a RESET SLAVE ALL command, a slave’s GTID filters are not cleared (DO_DOMAIN_IDS, IGNORE_DOMIAN_IDS, IGNORE_SERVER_IDS). MySQL had a similar bug report, Bug #18816897, which fixed this issue to clear IGNORE_SERVER_IDS after issuing RESET SLAVE ALL in version 5.7. Solution: ========= To fix the first problem, the CHANGE MASTER error handling logic was extended to transition the relay log state to LOG_CLOSED from LOG_TO_BE_OPENED. To fix the second problem, the RESET SLAVE ALL logic is extended to clear the domain_id filter and ignore_server_ids. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
Diffstat (limited to 'sql/log.h')
-rw-r--r--sql/log.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/log.h b/sql/log.h
index 0770861fe01..6896a4ff550 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -896,6 +896,20 @@ public:
void unlock_binlog_end_pos() { mysql_mutex_unlock(&LOCK_binlog_end_pos); }
mysql_mutex_t* get_binlog_end_pos_lock() { return &LOCK_binlog_end_pos; }
+ /*
+ Ensures the log's state is either LOG_OPEN or LOG_CLOSED. If something
+ failed along the desired path and left the log in invalid state, i.e.
+ LOG_TO_BE_OPENED, forces the state to be LOG_CLOSED.
+ */
+ void try_fix_log_state()
+ {
+ mysql_mutex_lock(get_log_lock());
+ /* Only change the log state if it is LOG_TO_BE_OPENED */
+ if (log_state == LOG_TO_BE_OPENED)
+ log_state= LOG_CLOSED;
+ mysql_mutex_unlock(get_log_lock());
+ }
+
int wait_for_update_binlog_end_pos(THD* thd, struct timespec * timeout);
/*