diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-06-26 12:10:35 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-06-26 12:10:35 +0200 |
commit | 7e5dc4f074b7d1cee4721e6fa49d6e5628ef793f (patch) | |
tree | 1df1473973c1cb97d8d1a4f0a25028d3b74c39cb /sql/log.h | |
parent | 535de71728ff92747b46e985b339d23b4587a9c4 (diff) | |
download | mariadb-git-7e5dc4f074b7d1cee4721e6fa49d6e5628ef793f.tar.gz |
MDEV-4506: Parallel replication. Intermediate commit.
Implement facility for the commit in one thread to wait for the commit of
another to complete first. The wait is done in a way that does not hinder
that a waiter and a waitee can group commit together with a single fsync()
in both binlog and InnoDB. The wait is done efficiently with respect to
locking.
The patch was originally made to support TaoBao parallel replication with
in-order commit; now it will be adapted to also be used for parallel
replication of group-committed transactions.
A waiter THD registers itself with a prior waitee THD. The waiter will then
complete its commit at the earliest in the same group commit of the waitee
(when using binlog). The wait can also be done explicitly by the waitee.
Diffstat (limited to 'sql/log.h')
-rw-r--r-- | sql/log.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/log.h b/sql/log.h index 0b1344aa523..2345f0acf9c 100644 --- a/sql/log.h +++ b/sql/log.h @@ -45,6 +45,15 @@ class TC_LOG virtual int open(const char *opt_name)=0; virtual void close()=0; + /* + Transaction coordinator 2-phase commit. + + Must invoke the run_prepare_ordered and run_commit_ordered methods, as + described below for these methods. + + In addition, must invoke THD::wait_for_prior_commit(), or equivalent + wait, to ensure that one commit waits for another if registered to do so. + */ virtual int log_and_order(THD *thd, my_xid xid, bool all, bool need_prepare_ordered, bool need_commit_ordered) = 0; @@ -397,6 +406,7 @@ private: class binlog_cache_mngr; struct rpl_gtid; +class wait_for_commit; class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG { private: @@ -445,6 +455,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG group commit, only used when opt_optimize_thread_scheduling is not set. */ bool check_purge; + /* Flag used to optimise around wait_for_prior_commit. */ + bool queued_by_other; ulong binlog_id; }; @@ -526,6 +538,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG void do_checkpoint_request(ulong binlog_id); void purge(); int write_transaction_or_stmt(group_commit_entry *entry, uint64 commit_id); + bool queue_for_group_commit(group_commit_entry *entry, wait_for_commit *wfc); bool write_transaction_to_binlog_events(group_commit_entry *entry); void trx_group_commit_leader(group_commit_entry *leader); bool is_xidlist_idle_nolock(); |