diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-10-31 14:11:41 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-10-31 14:11:41 +0100 |
commit | 39df665a3332bd9bfb2529419f534a49cfac388c (patch) | |
tree | 0b431c7e00a4ef8344a5fbde2cdac4935ec204b1 /sql/log_event.cc | |
parent | 9c8da4ed762a4ad092e23cc07c34212320341ac1 (diff) | |
download | mariadb-git-39df665a3332bd9bfb2529419f534a49cfac388c.tar.gz |
MDEV-5206: Incorrect slave old-style position in MDEV-4506, parallel replication.
In parallel replication, there are two kinds of events which are
executed in different ways.
Normal events that are part of event groups/transactions are executed
asynchroneously by being queued for a worker thread.
Other events like format description and rotate and such are executed
directly in the driver SQL thread.
If the direct execution of the other events were to update the old-style
position, then the position gets updated too far ahead, before the normal
events that have been queued for a worker thread have been executed. So
this patch adds some special cases to prevent such position updates ahead
of time, and instead queues dummy events for the worker threads, so that
they will at an appropriate time do the position updates instead.
(Also fix a race in a test case that happened to trigger while running
tests for this patch).
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index e7c0506a50a..7ce6c203248 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -966,11 +966,17 @@ int Log_event::do_update_pos(rpl_group_info *rgi) if (debug_not_change_ts_if_art_event == 1 && is_artificial_event()) debug_not_change_ts_if_art_event= 0; ); - rli->stmt_done(log_pos, - (is_artificial_event() && - IF_DBUG(debug_not_change_ts_if_art_event > 0, 1) ? - 0 : when), - thd, rgi); + /* + In parallel execution, delay position update for the events that are + not part of event groups (format description, rotate, and such) until + the actual event execution reaches that point. + */ + if (!rgi->is_parallel_exec || is_group_event(get_type_code())) + rli->stmt_done(log_pos, + (is_artificial_event() && + IF_DBUG(debug_not_change_ts_if_art_event > 0, 1) ? + 0 : when), + thd, rgi); DBUG_EXECUTE_IF("let_first_flush_log_change_timestamp", if (debug_not_change_ts_if_art_event == 0) debug_not_change_ts_if_art_event= 2; ); |