do nothing in waitForOutdatedPartsToBeLoaded() if loading is not required

This commit is contained in:
serxa 2024-03-12 11:38:27 +00:00
parent bdc884dfa5
commit defed92331

View File

@ -1979,6 +1979,15 @@ void MergeTreeData::waitForOutdatedPartsToBeLoaded() const TSA_NO_THREAD_SAFETY_
if (isStaticStorage()) if (isStaticStorage())
return; return;
/// If waiting is not required, do NOT log and do NOT enable/disable turbo mode to make `waitForOutdatedPartsToBeLoaded` a lightweight check
{
std::unique_lock lock(outdated_data_parts_mutex);
if (outdated_data_parts_loading_canceled)
throw Exception(ErrorCodes::NOT_INITIALIZED, "Loading of outdated data parts was already canceled");
if (outdated_data_parts_loading_finished)
return;
}
/// We need to load parts as fast as possible /// We need to load parts as fast as possible
getOutdatedPartsLoadingThreadPool().enableTurboMode(); getOutdatedPartsLoadingThreadPool().enableTurboMode();
SCOPE_EXIT({ SCOPE_EXIT({