summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.h
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2014-12-05 16:09:48 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2014-12-06 08:49:50 +0100
commitdb21fddc3740dfa48f3443751c48282467afac5e (patch)
tree3ed31a4a5ce9abf3fe98cdd9c9bdf68ba8b5832b /sql/rpl_rli.h
parent1e3f09f1638e2bdec6029f6c98317d17d7ca76d1 (diff)
downloadmariadb-git-db21fddc3740dfa48f3443751c48282467afac5e.tar.gz
MDEV-6676: Optimistic parallel replication
Implement a new mode for parallel replication. In this mode, all transactions are optimistically attempted applied in parallel. In case of conflicts, the offending transaction is rolled back and retried later non-parallel. This is an early-release patch to facilitate testing, more changes to user interface / options will be expected. The new mode is not enabled by default.
Diffstat (limited to 'sql/rpl_rli.h')
-rw-r--r--sql/rpl_rli.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 9885417aa3f..ddf6c2ccc71 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -621,6 +621,8 @@ struct rpl_group_info
counting one event group twice.
*/
bool did_mark_start_commit;
+ /* Copy of flags2 from GTID event. */
+ uchar gtid_ev_flags2;
enum {
GTID_DUPLICATE_NULL=0,
GTID_DUPLICATE_IGNORE=1,
@@ -652,6 +654,36 @@ struct rpl_group_info
inuse_relaylog *relay_log;
uint64 retry_start_offset;
uint64 retry_event_count;
+ /*
+ If `speculation' is != SPECULATE_NO, then we are optimistically running
+ this transaction in parallel, even though it might not be safe (there may
+ be a conflict with a prior event group).
+
+ In this case, a conflict can cause other errors than deadlocks (like
+ duplicate key for example). So in case of _any_ error, we need to roll
+ back and retry the event group.
+ */
+ enum enum_speculation {
+ /*
+ This transaction was group-committed together on the master with the
+ other transactions with which it is replicated in parallel.
+ */
+ SPECULATE_NO,
+ /*
+ We will optimistically try to run this transaction in parallel with
+ other transactions, even though it is not known to be conflict free.
+ If we get a conflict, we will detect it as a deadlock, roll back and
+ retry.
+ */
+ SPECULATE_OPTIMISTIC,
+ /*
+ This transaction got a conflict during speculative parallel apply, or
+ it was marked on the master as likely to cause a conflict or unsafe to
+ speculate. So it will wait for the prior transaction to commit before
+ starting to replicate.
+ */
+ SPECULATE_WAIT
+ } speculation;
bool killed_for_retry;
rpl_group_info(Relay_log_info *rli_);