Merge pull request #36388 from kssenii/fix-s3-tests-3

Fix test 01161_all_system_tables under s3 storage
This commit is contained in:
Kseniia Sumarokova 2022-04-20 15:46:12 +02:00 committed by GitHub
commit df8312b357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -357,13 +357,35 @@ std::vector<String> IDiskRemote::getRemotePaths(const String & local_path) const
void IDiskRemote::getRemotePathsRecursive(const String & local_path, std::vector<LocalPathWithRemotePaths> & paths_map)
{
/// Protect against concurrent delition of files (for example because of a merge).
if (metadata_disk->isFile(local_path))
{
paths_map.emplace_back(local_path, getRemotePaths(local_path));
try
{
paths_map.emplace_back(local_path, getRemotePaths(local_path));
}
catch (const Exception & e)
{
if (e.code() == ErrorCodes::FILE_DOESNT_EXIST)
return;
throw;
}
}
else
{
for (auto it = iterateDirectory(local_path); it->isValid(); it->next())
DiskDirectoryIteratorPtr it;
try
{
it = iterateDirectory(local_path);
}
catch (const fs::filesystem_error & e)
{
if (e.code() == std::errc::no_such_file_or_directory)
return;
throw;
}
for (; it->isValid(); it->next())
IDiskRemote::getRemotePathsRecursive(fs::path(local_path) / it->name(), paths_map);
}
}