Remove getRemotePathsRecursive() from IDisk

This commit is contained in:
Alexander Gololobov 2024-04-12 18:34:51 +02:00
parent 69bc0b9176
commit 85cd0291a5
3 changed files with 0 additions and 79 deletions

View File

@ -320,15 +320,6 @@ public:
{}
};
virtual void getRemotePathsRecursive(
const String &, std::vector<LocalPathWithObjectStoragePaths> &, const std::function<bool(const String &)> & /* skip_predicate */)
{
throw Exception(
ErrorCodes::NOT_IMPLEMENTED,
"Method `getRemotePathsRecursive() not implemented for disk: {}`",
getDataSourceDescription().toString());
}
/// Batch request to remove multiple files.
/// May be much faster for blob storage.
/// Second bool param is a flag to remove (true) or keep (false) shared data on S3.

View File

@ -23,10 +23,6 @@ namespace DB
namespace ErrorCodes
{
extern const int INCORRECT_DISK_INDEX;
extern const int FILE_DOESNT_EXIST;
extern const int ATTEMPT_TO_READ_AFTER_EOF;
extern const int CANNOT_READ_ALL_DATA;
extern const int DIRECTORY_DOESNT_EXIST;
}
@ -91,67 +87,6 @@ StoredObjects DiskObjectStorage::getStorageObjects(const String & local_path) co
return metadata_storage->getStorageObjects(local_path);
}
void DiskObjectStorage::getRemotePathsRecursive(
const String & local_path,
std::vector<LocalPathWithObjectStoragePaths> & paths_map,
const std::function<bool(const String &)> & skip_predicate)
{
if (!metadata_storage->exists(local_path))
return;
if (skip_predicate && skip_predicate(local_path))
return;
/// Protect against concurrent delition of files (for example because of a merge).
if (metadata_storage->isFile(local_path))
{
try
{
paths_map.emplace_back(local_path, getStorageObjects(local_path));
}
catch (const Exception & e)
{
/// Unfortunately in rare cases it can happen when files disappear
/// or can be empty in case of operation interruption (like cancelled metadata fetch)
if (e.code() == ErrorCodes::FILE_DOESNT_EXIST ||
e.code() == ErrorCodes::DIRECTORY_DOESNT_EXIST ||
e.code() == ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF ||
e.code() == ErrorCodes::CANNOT_READ_ALL_DATA)
return;
throw;
}
}
else
{
DirectoryIteratorPtr it;
try
{
it = iterateDirectory(local_path);
}
catch (const Exception & e)
{
/// Unfortunately in rare cases it can happen when files disappear
/// or can be empty in case of operation interruption (like cancelled metadata fetch)
if (e.code() == ErrorCodes::FILE_DOESNT_EXIST ||
e.code() == ErrorCodes::DIRECTORY_DOESNT_EXIST ||
e.code() == ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF ||
e.code() == ErrorCodes::CANNOT_READ_ALL_DATA)
return;
throw;
}
catch (const fs::filesystem_error & e)
{
if (e.code() == std::errc::no_such_file_or_directory)
return;
throw;
}
for (; it->isValid(); it->next())
DiskObjectStorage::getRemotePathsRecursive(fs::path(local_path) / it->name(), paths_map, skip_predicate);
}
}
bool DiskObjectStorage::exists(const String & path) const
{

View File

@ -48,11 +48,6 @@ public:
StoredObjects getStorageObjects(const String & local_path) const override;
void getRemotePathsRecursive(
const String & local_path,
std::vector<LocalPathWithObjectStoragePaths> & paths_map,
const std::function<bool(const String &)> & skip_predicate) override;
const std::string & getCacheName() const override { return object_storage->getCacheName(); }
std::optional<UInt64> getTotalSpace() const override { return {}; }