mirror of
https://github.com/MariaDB/server.git
synced 2026-05-17 20:37:12 +02:00
MDEV-24302 follow-up: RESET MASTER hangs
As pointed out by Andrei Elkin, the previous fix did not fix one race condition that may have caused the observed hang. innodb_log_flush_request(): If we are enqueueing the very first request at the same time the log write is being completed, we must ensure that a near-concurrent call to log_flush_notify() will not result in a missed notification. We guarantee this by release-acquire operations on log_requests.start and log_sys.flushed_to_disk_lsn. log_flush_notify_and_unlock(): Cleanup: Always release the mutex. log_sys_t::get_flushed_lsn(): Use acquire memory order. log_sys_t::set_flushed_lsn(): Use release memory order. log_sys_t::set_lsn(): Use release memory order. log_sys_t::get_lsn(): Use relaxed memory order by default, and allow the caller to specify acquire memory order explicitly. Whenever the log_sys.mutex is being held or when log writes are prohibited during startup, we can use a relaxed load. Likewise, in some assertions where reading a stale value of log_sys.lsn should not matter, we can use a relaxed load. This will cause some additional instructions to be emitted on architectures that do not implement Total Store Ordering (TSO), such as POWER, ARM, and RISC-V Weak Memory Ordering (RVWMO).
This commit is contained in:
parent
0df74a0197
commit
8c2e3259c1
7 changed files with 71 additions and 69 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2020, MariaDB
|
||||
/* Copyright (c) 2020, 2021, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -41,7 +41,9 @@ public:
|
|||
Atomic_relaxed(Type val) : m(val) {}
|
||||
Atomic_relaxed() {}
|
||||
|
||||
operator Type() const { return m.load(std::memory_order_relaxed); }
|
||||
Type load(std::memory_order o= std::memory_order_relaxed) const
|
||||
{ return m.load(o); }
|
||||
operator Type() const { return m.load(); }
|
||||
Type operator=(const Type val)
|
||||
{ m.store(val, std::memory_order_relaxed); return val; }
|
||||
Type operator=(const Atomic_relaxed<Type> &rhs) { return *this= Type{rhs}; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue