Trying to investigate the errors after attaching the part.

+ A new entry is added to the part_log.
This commit is contained in:
Mike Kot 2021-03-17 18:49:04 +03:00
parent 831b90f272
commit e309dd275a
2 changed files with 12 additions and 1 deletions

View File

@ -460,7 +460,7 @@ public:
/// Remove parts from working set immediately (without wait for background
/// process). Transfer part state to temporary. Have very limited usage only
/// for new parts which don't already present in table.
/// for new parts which aren't already present in table.
void removePartsFromWorkingSetImmediatelyAndSetTemporaryState(const DataPartsVector & remove);
/// Removes parts from the working set parts.

View File

@ -1382,7 +1382,11 @@ MergeTreeData::MutableDataPartPtr StorageReplicatedMergeTree::attachPartHelperFo
part->loadColumnsChecksumsIndexes(true, false);
if (entry.part_checksum == part->checksums.getTotalChecksumHex())
{
part->is_temp = true;
part->modification_time = disk->getLastModified(part_path).epochTime();
return part;
}
}
return {};
@ -1437,6 +1441,12 @@ bool StorageReplicatedMergeTree::executeLogEntry(LogEntry & entry)
renameTempPartAndReplace(part, nullptr, &transaction);
checkPartChecksumsAndCommit(transaction, part);
writePartLog(PartLogElement::Type::NEW_PART, {},
0, // well, not really, but don't have the idea how to measure the time here TODO
part->name, part,
{part}, // not sure whether the initial parts vector should be empty or contain the part itself TODO
nullptr);
return true;
}
@ -3706,6 +3716,7 @@ bool StorageReplicatedMergeTree::fetchPart(const String & part_name, const Stora
String interserver_scheme;
std::optional<CurrentlySubmergingEmergingTagger> tagger_ptr;
std::function<MutableDataPartPtr()> get_part;
if (part_to_clone)
{
get_part = [&, part_to_clone]()