Disk empty name fix

This commit is contained in:
Mike Kot 2021-08-25 21:18:12 +02:00
parent 407af64280
commit 1f3701d485
2 changed files with 6 additions and 4 deletions

View File

@ -895,7 +895,7 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks)
for (const auto it = disk->iterateDirectory(relative_data_path); it->isValid(); it->next())
{
if (MergeTreePartInfo::tryParsePartName(it->name(), format_version))
throw Exception(ErrorCodes::UNKNOWN_DISK,
throw Exception(ErrorCodes::UNKNOWN_DISK,
"Part {} was found on disk {} which is not defined in the storage policy",
backQuote(it->name()), backQuote(disk_name));
}
@ -3569,8 +3569,10 @@ std::vector<DetachedPartInfo> MergeTreeData::getDetachedParts() const
{
for (auto it = disk->iterateDirectory(detached_path); it->isValid(); it->next())
{
auto res_it = res.emplace_back(DetachedPartInfo::parseDetachedPartName(it->name(), format_version));
res_it.disk = disk->getName();
auto part = DetachedPartInfo::parseDetachedPartName(it->name(), format_version);
part.disk = disk->getName();
res.push_back(std::move(part));
}
}
}

View File

@ -125,7 +125,7 @@ struct DetachedPartInfo : public MergeTreePartInfo
/// If false, MergeTreePartInfo is in invalid state (directory name was not successfully parsed).
bool valid_name;
static constexpr auto DETACH_REASONS = std::to_array<std::string_view>({
static constexpr auto DETACH_REASONS = std::to_array<std::string_view>({
"broken", "unexpected", "noquorum",
"ignored", "broken-on-start", "clone",
"attaching", "deleting", "tmp-fetch"