mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Make the error message about broken parts more useful.
This commit is contained in:
parent
38126bb436
commit
5bea6751e0
@ -739,10 +739,25 @@ void IMergeTreeDataPart::loadColumnsChecksumsIndexes(bool require_columns_checks
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
/// Don't scare people with broken part error
|
||||
/// Don't scare people with broken part error if it's retryable.
|
||||
if (!isRetryableException(std::current_exception()))
|
||||
{
|
||||
LOG_ERROR(storage.log, "Part {} is broken and needs manual correction", getDataPartStorage().getFullPath());
|
||||
|
||||
if (Exception * e = exception_cast<Exception *>(std::current_exception()))
|
||||
{
|
||||
/// Probably there is something wrong with files of this part.
|
||||
/// So it can be helpful to add to the error message some information about those files.
|
||||
String files_in_part;
|
||||
for (auto it = getDataPartStorage().iterate(); it->isValid(); it->next())
|
||||
files_in_part += fmt::format("{}{} ({} bytes)", (files_in_part.empty() ? "" : ", "), it->name(), getDataPartStorage().getFileSize(it->name()));
|
||||
if (!files_in_part.empty())
|
||||
e->addMessage("Part contains files: {}", files_in_part);
|
||||
if (isEmpty())
|
||||
e->addMessage("Part is empty");
|
||||
}
|
||||
}
|
||||
|
||||
// There could be conditions that data part to be loaded is broken, but some of meta infos are already written
|
||||
// into metadata before exception, need to clean them all.
|
||||
metadata_manager->deleteAll(/*include_projection*/ true);
|
||||
|
@ -5634,9 +5634,11 @@ void MergeTreeData::restorePartFromBackup(std::shared_ptr<RestoredPartsHolder> r
|
||||
String part_name = part_info.getPartNameAndCheckFormat(format_version);
|
||||
auto backup = restored_parts_holder->getBackup();
|
||||
|
||||
/// Find all files of this part in the backup.
|
||||
Strings filenames = backup->listFiles(part_path_in_backup, /* recursive= */ true);
|
||||
|
||||
/// Calculate the total size of the part.
|
||||
UInt64 total_size_of_part = 0;
|
||||
Strings filenames = backup->listFiles(part_path_in_backup, /* recursive= */ true);
|
||||
fs::path part_path_in_backup_fs = part_path_in_backup;
|
||||
for (const String & filename : filenames)
|
||||
total_size_of_part += backup->getFileSize(part_path_in_backup_fs / filename);
|
||||
|
Loading…
Reference in New Issue
Block a user