diff options
author | Jonas Oreland <jonaso@google.com> | 2014-12-23 13:38:00 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-12-23 14:16:32 +0100 |
commit | 0b87de124d716cee7c1aa56f30c7f80c2c2bfcce (patch) | |
tree | 5557407d03402bdf28daf1b64e438362358f6188 /sql/rpl_handler.cc | |
parent | 4d8b346e079a27960dbe49e4d0ec4364bed8d30e (diff) | |
download | mariadb-git-0b87de124d716cee7c1aa56f30c7f80c2c2bfcce.tar.gz |
MDEV-162 Enhanced semisync replication
Implement --semi-sync-master-wait-point=AFTER_SYNC|AFTER_COMMIT.
When AFTER_SYNC, the semi-sync wait will be done earlier, before the storage
engine commit rather than after. This means that a transaction will not be
visible on the master until at least one slave has received it.
Diffstat (limited to 'sql/rpl_handler.cc')
-rw-r--r-- | sql/rpl_handler.cc | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index 09e221e9bd5..2c388e572f9 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -252,12 +252,18 @@ int Trans_delegate::after_rollback(THD *thd, bool all) int Binlog_storage_delegate::after_flush(THD *thd, const char *log_file, my_off_t log_pos, - bool synced) + bool synced, + bool first_in_group, + bool last_in_group) { Binlog_storage_param param; uint32 flags=0; if (synced) flags |= BINLOG_STORAGE_IS_SYNCED; + if (first_in_group) + flags|= BINLOG_GROUP_COMMIT_LEADER; + if (last_in_group) + flags|= BINLOG_GROUP_COMMIT_TRAILER; Trans_binlog_info *log_info= my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); @@ -279,6 +285,27 @@ int Binlog_storage_delegate::after_flush(THD *thd, return ret; } +int Binlog_storage_delegate::after_sync(THD *thd, + const char *log_file, + my_off_t log_pos, + bool first_in_group, + bool last_in_group) +{ + Binlog_storage_param param; + uint32 flags=0; + + if (first_in_group) + flags|= BINLOG_GROUP_COMMIT_LEADER; + if (last_in_group) + flags|= BINLOG_GROUP_COMMIT_TRAILER; + + int ret= 0; + FOREACH_OBSERVER(ret, after_sync, thd, + (¶m, log_file+dirname_length(log_file), log_pos, flags)); + + return ret; +} + #ifdef HAVE_REPLICATION int Binlog_transmit_delegate::transmit_start(THD *thd, ushort flags, const char *log_file, |