mirror of
https://github.com/MariaDB/server.git
synced 2026-04-26 18:25:30 +02:00
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.
This commit is contained in:
parent
1e3f09f163
commit
db21fddc37
55 changed files with 2596 additions and 466 deletions
|
|
@ -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_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue