mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Fix atomic usage
This commit is contained in:
parent
c5dcde0c78
commit
3b58e9cd67
@ -140,9 +140,9 @@ void ReplicatedMergeTreeRestartingThread::run()
|
||||
|
||||
ProfileEvents::increment(ProfileEvents::ReplicaYieldLeadership);
|
||||
|
||||
if (storage.is_leader_node)
|
||||
bool old_val = true;
|
||||
if (storage.is_leader_node.compare_exchange_strong(old_val, false))
|
||||
{
|
||||
storage.is_leader_node = false;
|
||||
CurrentMetrics::sub(CurrentMetrics::LeaderReplica);
|
||||
if (storage.merge_selecting_thread.joinable())
|
||||
storage.merge_selecting_thread.join();
|
||||
@ -376,9 +376,9 @@ void ReplicatedMergeTreeRestartingThread::partialShutdown()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(storage.leader_node_mutex);
|
||||
|
||||
if (storage.is_leader_node)
|
||||
bool old_val = true;
|
||||
if (storage.is_leader_node.compare_exchange_strong(old_val, false))
|
||||
{
|
||||
storage.is_leader_node = false;
|
||||
CurrentMetrics::sub(CurrentMetrics::LeaderReplica);
|
||||
if (storage.merge_selecting_thread.joinable())
|
||||
storage.merge_selecting_thread.join();
|
||||
|
Loading…
Reference in New Issue
Block a user