mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #60462 from ClickHouse/davenger-patch-1
Do not check to and from files existence in metadata_storage because it does not see uncommitted changes
This commit is contained in:
commit
e66ac5770c
@ -23,7 +23,6 @@ namespace ErrorCodes
|
||||
extern const int CANNOT_OPEN_FILE;
|
||||
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;
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
@ -593,14 +592,8 @@ void DiskObjectStorageTransaction::moveDirectory(const std::string & from_path,
|
||||
void DiskObjectStorageTransaction::moveFile(const String & from_path, const String & to_path)
|
||||
{
|
||||
operations_to_execute.emplace_back(
|
||||
std::make_unique<PureMetadataObjectStorageOperation>(object_storage, metadata_storage, [from_path, to_path, this](MetadataTransactionPtr tx)
|
||||
std::make_unique<PureMetadataObjectStorageOperation>(object_storage, metadata_storage, [from_path, to_path](MetadataTransactionPtr tx)
|
||||
{
|
||||
if (metadata_storage.exists(to_path))
|
||||
throw Exception(ErrorCodes::FILE_ALREADY_EXISTS, "File already exists: {}", to_path);
|
||||
|
||||
if (!metadata_storage.exists(from_path))
|
||||
throw Exception(ErrorCodes::FILE_DOESNT_EXIST, "File {} doesn't exist, cannot move", from_path);
|
||||
|
||||
tx->moveFile(from_path, to_path);
|
||||
}));
|
||||
}
|
||||
|
@ -623,6 +623,15 @@ void DataPartStorageOnDiskBase::remove(
|
||||
}
|
||||
}
|
||||
|
||||
if (!disk->exists(from))
|
||||
{
|
||||
LOG_ERROR(log, "Directory {} (part to remove) doesn't exist or one of nested files has gone. Most likely this is due to manual removing. This should be discouraged. Ignoring.", fullPath(disk, from));
|
||||
/// We will never touch this part again, so unlocking it from zero-copy
|
||||
if (!can_remove_description)
|
||||
can_remove_description.emplace(can_remove_callback());
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
disk->moveDirectory(from, to);
|
||||
|
Loading…
Reference in New Issue
Block a user