More logs on unsuccessful part removal

This commit is contained in:
alesapin 2022-04-04 13:17:33 +02:00
parent e6c9a36ac7
commit 885447342c
3 changed files with 13 additions and 3 deletions

View File

@ -136,7 +136,7 @@ std::string ExternalDictionariesLoader::resolveDictionaryNameFromDatabaseCatalog
if (qualified_name->database.empty()) if (qualified_name->database.empty())
{ {
/// Ether database name is not specified and we should use current one /// Either database name is not specified and we should use current one
/// or it's an XML dictionary. /// or it's an XML dictionary.
bool is_xml_dictionary = has(name); bool is_xml_dictionary = has(name);
if (is_xml_dictionary) if (is_xml_dictionary)

View File

@ -2953,7 +2953,8 @@ void MergeTreeData::tryRemovePartImmediately(DataPartPtr && part)
{ {
auto lock = lockParts(); auto lock = lockParts();
LOG_TRACE(log, "Trying to immediately remove part {}", part->getNameWithState()); auto part_name_with_state = part->getNameWithState();
LOG_TRACE(log, "Trying to immediately remove part {}", part_name_with_state);
if (part->getState() != DataPartState::Temporary) if (part->getState() != DataPartState::Temporary)
{ {
@ -2964,7 +2965,16 @@ void MergeTreeData::tryRemovePartImmediately(DataPartPtr && part)
part.reset(); part.reset();
if (!((*it)->getState() == DataPartState::Outdated && it->unique())) if (!((*it)->getState() == DataPartState::Outdated && it->unique()))
{
if (!(*it)->getState() == DataPartState::Outdated)
LOG_WARNING("Cannot immediately remove part {} because it's not in Outdated state "
"usage counter {}", part_name_with_state, it->use_count());
if (!it->unique())
LOG_WARNING("Cannot immediately remove part {} because someone using it right now "
"usage counter {}", part_name_with_state, it->use_count());
return; return;
}
modifyPartState(it, DataPartState::Deleting); modifyPartState(it, DataPartState::Deleting);

View File

@ -3321,7 +3321,7 @@ void StorageReplicatedMergeTree::removePartAndEnqueueFetch(const String & part_n
if (!broken_part_info.contains(part->info)) if (!broken_part_info.contains(part->info))
continue; continue;
/// Broken part itself ether already moved to detached or does not exist. /// Broken part itself either already moved to detached or does not exist.
assert(broken_part_info != part->info); assert(broken_part_info != part->info);
part->makeCloneInDetached("covered-by-broken", getInMemoryMetadataPtr()); part->makeCloneInDetached("covered-by-broken", getInMemoryMetadataPtr());
} }