Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #46325 to 22.8: Refine removing metadata file with invalid format for DiskObjectStorage #46394

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace ErrorCodes
extern const int FILE_DOESNT_EXIST;
extern const int BAD_FILE_TYPE;
extern const int FILE_ALREADY_EXISTS;
extern const int CANNOT_PARSE_INPUT_ASSERTION_FAILED;
}

DiskObjectStorageTransaction::DiskObjectStorageTransaction(
Expand Down Expand Up @@ -187,8 +188,15 @@ struct RemoveRecursiveObjectStorageOperation final : public IDiskObjectStorageOp
if (e.code() == ErrorCodes::UNKNOWN_FORMAT
|| e.code() == ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF
|| e.code() == ErrorCodes::CANNOT_READ_ALL_DATA
|| e.code() == ErrorCodes::CANNOT_OPEN_FILE)
|| e.code() == ErrorCodes::CANNOT_OPEN_FILE
|| e.code() == ErrorCodes::CANNOT_PARSE_INPUT_ASSERTION_FAILED)
{
LOG_DEBUG(
&Poco::Logger::get("RemoveRecursiveObjectStorageOperation"),
"Can't read metadata because of an exception. Just remove it from the filesystem. Path: {}, exception: {}",
metadata_storage.getPath() + path_to_remove,
e.message());

tx->unlinkFile(path_to_remove);
}
else
Expand Down