Commit 7781cdb7 authored by unknown's avatar unknown

MDEV-4506: parallel replication.

Add comments explaining tricky memory barrier semantics and
suggestions for future changes.
parent 5633dd82
......@@ -6757,6 +6757,18 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *entry)
{
if (list->wakeup_subsequent_commits_running)
{
/*
ToDo: We should not need a full lock/unlock of LOCK_wait_commit
here. All we need is a single (full) memory barrier, to ensure that
the reads of the list above are not reordered with the write of
wakeup_subsequent_commits_running, or with the writes to the list
from other threads that is allowed to happen after
wakeup_subsequent_commits_running has been set to false.
We do not currently have explicit memory barrier primitives in the
source tree, but if we get them the below mysql_mutex_lock() could
be replaced with a full memory barrier just before the loop.
*/
mysql_mutex_lock(&list->LOCK_wait_commit);
list->wakeup_subsequent_commits_running= false;
mysql_mutex_unlock(&list->LOCK_wait_commit);
......
......@@ -5754,6 +5754,19 @@ wait_for_commit::wakeup_subsequent_commits2()
waiter= next;
}
/*
ToDo: We should not need a full lock/unlock of LOCK_wait_commit here. All
we need is a (full) memory barrier, to ensure that the reads of the list
above are not reordered with the write of
wakeup_subsequent_commits_running, or with the writes to the list from
other threads that is allowed to happen after
wakeup_subsequent_commits_running has been set to false.
We do not currently have explicit memory barrier primitives in the source
tree, but if we get them the below mysql_mutex_lock() could be replaced
with a full memory barrier. It is probably not important, the lock is not
contented and will likely be in the CPU cache since we took it just before.
*/
mysql_mutex_lock(&LOCK_wait_commit);
wakeup_subsequent_commits_running= false;
mysql_mutex_unlock(&LOCK_wait_commit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment