summaryrefslogtreecommitdiff
path: root/sql/log.h
diff options
context:
space:
mode:
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 000d22854e9..b55ed0f31f6 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -951,6 +951,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);
/*