Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/Storages/MergeTree/MergeTreeDeduplicationLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
#include <Disks/WriteMode.h>
#include <Disks/IDisk.h>

#include <Common/Exception.h>

namespace DB
{

namespace ErrorCodes
{
extern const int ABORTED;
}

namespace
{

Expand Down Expand Up @@ -227,7 +234,12 @@ std::pair<MergeTreePartInfo, bool> MergeTreeDeduplicationLog::addPart(const std:
return std::make_pair(info, false);
}

assert(current_writer != nullptr);
if (stopped)
{
throw Exception(ErrorCodes::ABORTED, "Storage has been shutdown when we add this part.");
}

chassert(current_writer != nullptr);

/// Create new record
MergeTreeDeduplicationLogRecord record;
Expand Down Expand Up @@ -257,7 +269,12 @@ void MergeTreeDeduplicationLog::dropPart(const MergeTreePartInfo & drop_part_inf
if (deduplication_window == 0)
return;

assert(current_writer != nullptr);
if (stopped)
{
throw Exception(ErrorCodes::ABORTED, "Storage has been shutdown when we drop this part.");
}

chassert(current_writer != nullptr);

for (auto itr = deduplication_map.begin(); itr != deduplication_map.end(); /* no increment here, we erasing from map */)
{
Expand Down