Browse Source
MDEV-20707: Missing memory barrier in parallel replication error handler in wait_for_prior_commit()
MDEV-20707: Missing memory barrier in parallel replication error handler in wait_for_prior_commit()
revision-id: 673e253724
Author: Kristian Nielsen
Fix missing memory barrier in wait_for_commit.
The function wait_for_commit::wait_for_prior_commit() has a fast path where it
checks without locks if wakeup_subsequent_commits() has already been called.
This check was missing a memory barrier. The waitee thread does two writes to
variables `waitee' and `wakeup_error', and if the waiting thread sees the
first write it _must_ also see the second or incorrect behavior will occur.
This requires memory barriers between both the writes (release semantics) and
the reads (acquire semantics) of those two variables.
Other accesses to these variables are done under lock or where only one thread
will be accessing them, and can be done without barriers (relaxed semantics).
pull/1413/head
3 changed files with 39 additions and 22 deletions
-
19sql/log.cc
-
25sql/sql_class.cc
-
17sql/sql_class.h
Write
Preview
Loading…
Cancel
Save
Reference in new issue