diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2015-06-23 14:10:14 +0200 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2015-06-24 16:52:50 +0200 |
commit | b89de2b2ce84f41351a66d5832c3967b80f9dc31 (patch) | |
tree | a4c7a5656d09bdb7498c0d90682b3f1496c966a1 /sql/rpl_rli.cc | |
parent | 93c039dd3ca1364ee7646ab4ee1e8490f0472d1c (diff) | |
download | mariadb-git-b89de2b2ce84f41351a66d5832c3967b80f9dc31.tar.gz |
MDEV-8354: out-of-order error with --gtid-ignore-duplicates and row-based replication
The --gtid-ignore-duplicates option was not working correctly with row-based
replication. When a row event was completed, but before committing, there
was a small window where another multi-source SQL thread could wrongly try
to re-execute the same transaction, without properly ignoring the duplicate
GTID. This would lead to duplicate key error or out-of-order GTID error or
similar.
Thanks to Matt Neth for reporting this and giving an easy way to reproduce
the issue.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index a324c3c30da..9ed388265be 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1788,6 +1788,13 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) rli->clear_flag(Relay_log_info::IN_STMT); rli->clear_flag(Relay_log_info::IN_TRANSACTION); } + + /* + Ensure we always release the domain for others to process, when using + --gtid-ignore-duplicates. + */ + if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL) + rpl_global_gtid_slave_state.release_domain_owner(this); } /* @@ -1797,13 +1804,6 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS; /* - Ensure we always release the domain for others to process, when using - --gtid-ignore-duplicates. - */ - if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL) - rpl_global_gtid_slave_state.release_domain_owner(this); - - /* Reset state related to long_find_row notes in the error log: - timestamp - flag that decides whether the slave prints or not @@ -1811,6 +1811,11 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) reset_row_stmt_start_timestamp(); unset_long_find_row_note_printed(); + DBUG_EXECUTE_IF("inject_sleep_gtid_100_x_x", { + if (current_gtid.domain_id == 100) + my_sleep(50000); + };); + DBUG_VOID_RETURN; } |