Merge pull request #18715 from ClickHouse/try-fix-tsan-forremote-query-executor

Use relaxed for flag in RemoteQueryExecutorReadContext.
This commit is contained in:
Nikolai Kochetov 2021-01-06 18:04:30 +03:00 committed by GitHub
commit a20c4cce76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -225,7 +225,7 @@ std::variant<Block, int> RemoteQueryExecutor::read(std::unique_ptr<ReadContext>
if (!read_context->resumeRoutine())
return Block();
if (read_context->is_read_in_progress)
if (read_context->is_read_in_progress.load(std::memory_order_relaxed))
{
read_context->setTimer();
return read_context->epoll_fd;

View File

@ -22,7 +22,7 @@ class RemoteQueryExecutorReadContext
public:
using Self = RemoteQueryExecutorReadContext;
bool is_read_in_progress = false;
std::atomic_bool is_read_in_progress = false;
Packet packet;
std::exception_ptr exception;
@ -162,7 +162,7 @@ public:
bool resumeRoutine()
{
if (is_read_in_progress && !checkTimeout())
if (is_read_in_progress.load(std::memory_order_relaxed) && !checkTimeout())
return false;
{
@ -226,9 +226,9 @@ public:
throw;
}
read_context.is_read_in_progress = true;
read_context.is_read_in_progress.store(true, std::memory_order_relaxed);
fiber = std::move(fiber).resume();
read_context.is_read_in_progress = false;
read_context.is_read_in_progress.store(false, std::memory_order_relaxed);
}
};