mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #28221 from azat/remove-Temporary-part-fix
Fix removing of parts in a Temporary state
This commit is contained in:
commit
531079c452
@ -2593,17 +2593,25 @@ void MergeTreeData::tryRemovePartImmediately(DataPartPtr && part)
|
||||
|
||||
LOG_TRACE(log, "Trying to immediately remove part {}", part->getNameWithState());
|
||||
|
||||
auto it = data_parts_by_info.find(part->info);
|
||||
if (it == data_parts_by_info.end() || (*it).get() != part.get())
|
||||
throw Exception("Part " + part->name + " doesn't exist", ErrorCodes::LOGICAL_ERROR);
|
||||
if (part->getState() != DataPartState::Temporary)
|
||||
{
|
||||
auto it = data_parts_by_info.find(part->info);
|
||||
if (it == data_parts_by_info.end() || (*it).get() != part.get())
|
||||
throw Exception("Part " + part->name + " doesn't exist", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
part.reset();
|
||||
part.reset();
|
||||
|
||||
if (!((*it)->getState() == DataPartState::Outdated && it->unique()))
|
||||
return;
|
||||
if (!((*it)->getState() == DataPartState::Outdated && it->unique()))
|
||||
return;
|
||||
|
||||
modifyPartState(it, DataPartState::Deleting);
|
||||
part_to_delete = *it;
|
||||
modifyPartState(it, DataPartState::Deleting);
|
||||
|
||||
part_to_delete = *it;
|
||||
}
|
||||
else
|
||||
{
|
||||
part_to_delete = std::move(part);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user