Exit fixes

This commit is contained in:
Mike Kot 2021-02-25 21:41:09 +03:00
parent b2c898f58c
commit 2b3b335eda
2 changed files with 10 additions and 11 deletions

View File

@ -1339,13 +1339,6 @@ MergeTreeData::MutableDataPartPtr StorageReplicatedMergeTree::attachPartHelperFo
return {};
}
void StorageReplicatedMergeTree::attachPart(MutableDataPartPtr& part)
{
Transaction transaction(*this);
renameTempPartAndAdd(part, nullptr, &transaction);
checkPartChecksumsAndCommit(transaction, part);
}
bool StorageReplicatedMergeTree::executeLogEntry(LogEntry & entry)
{
if (entry.type == LogEntry::DROP_RANGE)
@ -1361,8 +1354,17 @@ bool StorageReplicatedMergeTree::executeLogEntry(LogEntry & entry)
}
if (entry.type == LogEntry::ATTACH_PART)
{
if (MutableDataPartPtr part = attachPartHelperFoundValidPart(entry); part)
attachPart(part);
{
Transaction transaction(*this);
if (renameTempPartAndAdd(part, nullptr, &transaction))
checkPartChecksumsAndCommit(transaction, part);
return true;
}
}
const bool is_get_or_attach = entry.type == LogEntry::GET_PART || entry.type == LogEntry::ATTACH_PART;

View File

@ -410,9 +410,6 @@ private:
/// returns nullptr if the part is corrupt or missing.
MutableDataPartPtr attachPartHelperFoundValidPart(const LogEntry& entry) const;
/// Attach the part found in the detached/ folder
void attachPart(MutableDataPartPtr& part);
void executeDropRange(const LogEntry & entry);
/// Do the merge or recommend to make the fetch instead of the merge