Merge pull request #46278 from CheSema/race-check-table

fix data race between check table request and background checker
This commit is contained in:
robot-ch-test-poll2 2023-02-11 09:50:48 +01:00 committed by GitHub
commit 4e9d1275c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7847,18 +7847,23 @@ CheckResults StorageReplicatedMergeTree::checkData(const ASTPtr & query, Context
else
data_parts = getVisibleDataPartsVector(local_context);
for (auto & part : data_parts)
{
try
auto part_check_lock = part_check_thread.pausePartsCheck();
for (auto & part : data_parts)
{
results.push_back(part_check_thread.checkPart(part->name));
}
catch (const Exception & ex)
{
tryLogCurrentException(log, __PRETTY_FUNCTION__);
results.emplace_back(part->name, false, "Check of part finished with error: '" + ex.message() + "'");
try
{
results.push_back(part_check_thread.checkPart(part->name));
}
catch (const Exception & ex)
{
tryLogCurrentException(log, __PRETTY_FUNCTION__);
results.emplace_back(part->name, false, "Check of part finished with error: '" + ex.message() + "'");
}
}
}
return results;
}