check if storage shutdown before we operate MergeTreeDeduplicationLog

This commit is contained in:
Han Fei 2023-07-26 15:37:58 +02:00
parent 5f767b0dfa
commit dccbe875d2

View File

@ -10,6 +10,8 @@
#include <Disks/WriteMode.h>
#include <Disks/IDisk.h>
#include <Common/logger_useful.h>
namespace DB
{
@ -231,6 +233,12 @@ std::pair<MergeTreePartInfo, bool> MergeTreeDeduplicationLog::addPart(const std:
return std::make_pair(info, false);
}
if (stopped)
{
LOG_ERROR(&Poco::Logger::get("MergeTreeDeduplicationLog"), "Storage has been shutdown when we add this part.");
return {};
}
chassert(current_writer != nullptr);
/// Create new record
@ -261,6 +269,12 @@ void MergeTreeDeduplicationLog::dropPart(const MergeTreePartInfo & drop_part_inf
if (deduplication_window == 0)
return;
if (stopped)
{
LOG_ERROR(&Poco::Logger::get("MergeTreeDeduplicationLog"), "Storage has been shutdown when we drop this part.");
return;
}
chassert(current_writer != nullptr);
for (auto itr = deduplication_map.begin(); itr != deduplication_map.end(); /* no increment here, we erasing from map */)