diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2009-09-29 15:27:12 +0100 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2009-09-29 15:27:12 +0100 |
commit | 0110bd04d24503d84df93d31b444586c4137c98c (patch) | |
tree | 843223e93a47492e606ba45437990affb3529d89 /sql/log.h | |
parent | 25162d0166206ee4819ece2161d26caa01153723 (diff) | |
download | mariadb-git-0110bd04d24503d84df93d31b444586c4137c98c.tar.gz |
BUG#35542 Add option to sync master and relay log to disk after every event
BUG#31665 sync_binlog should cause relay logs to be synchronized
NOTE: Backporting the patch to next-mr.
Add sync_relay_log option to server, this option works for relay log
the same as option sync_binlog for binlog. This option also synchronize
master info to disk when set to non-zero value.
Original patches from Sinisa and Mark, with some modifications
Diffstat (limited to 'sql/log.h')
-rw-r--r-- | sql/log.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/sql/log.h b/sql/log.h index d306d6f7182..53943b649ee 100644 --- a/sql/log.h +++ b/sql/log.h @@ -269,6 +269,18 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG ulonglong m_table_map_version; + /* pointer to the sync period variable, for binlog this will be + sync_binlog_period, for relay log this will be + sync_relay_log_period + */ + uint *sync_period_ptr; + uint sync_counter; + + inline uint get_sync_period() + { + return *sync_period_ptr; + } + int write_to_file(IO_CACHE *cache); /* This is used to start writing to a new log file. The difference from @@ -296,7 +308,7 @@ public: Format_description_log_event *description_event_for_exec, *description_event_for_queue; - MYSQL_BIN_LOG(); + MYSQL_BIN_LOG(uint *sync_period); /* note that there's no destructor ~MYSQL_BIN_LOG() ! The reason is that we don't want it to be automatically called @@ -378,7 +390,20 @@ public: bool is_active(const char* log_file_name); int update_log_index(LOG_INFO* linfo, bool need_update_threads); void rotate_and_purge(uint flags); - bool flush_and_sync(); + /** + Flush binlog cache and synchronize to disk. + + This function flushes events in binlog cache to binary log file, + it will do synchronizing according to the setting of system + variable 'sync_binlog'. If file is synchronized, @c synced will + be set to 1, otherwise 0. + + @param[out] synced if not NULL, set to 1 if file is synchronized, otherwise 0 + + @retval 0 Success + @retval other Failure + */ + bool flush_and_sync(bool *synced); int purge_logs(const char *to_log, bool included, bool need_mutex, bool need_update_threads, ulonglong *decrease_log_space); |