@@ -23,10 +23,6 @@ namespace DB
2323namespace ErrorCodes
2424{
2525 extern const int INCORRECT_DISK_INDEX;
26- extern const int FILE_DOESNT_EXIST;
27- extern const int ATTEMPT_TO_READ_AFTER_EOF;
28- extern const int CANNOT_READ_ALL_DATA;
29- extern const int DIRECTORY_DOESNT_EXIST;
3026}
3127
3228
@@ -91,67 +87,6 @@ StoredObjects DiskObjectStorage::getStorageObjects(const String & local_path) co
9187 return metadata_storage->getStorageObjects (local_path);
9288}
9389
94- void DiskObjectStorage::getRemotePathsRecursive (
95- const String & local_path,
96- std::vector<LocalPathWithObjectStoragePaths> & paths_map,
97- const std::function<bool (const String &)> & skip_predicate)
98- {
99- if (!metadata_storage->exists (local_path))
100- return ;
101-
102- if (skip_predicate && skip_predicate (local_path))
103- return ;
104-
105- // / Protect against concurrent delition of files (for example because of a merge).
106- if (metadata_storage->isFile (local_path))
107- {
108- try
109- {
110- paths_map.emplace_back (local_path, getStorageObjects (local_path));
111- }
112- catch (const Exception & e)
113- {
114- // / Unfortunately in rare cases it can happen when files disappear
115- // / or can be empty in case of operation interruption (like cancelled metadata fetch)
116- if (e.code () == ErrorCodes::FILE_DOESNT_EXIST ||
117- e.code () == ErrorCodes::DIRECTORY_DOESNT_EXIST ||
118- e.code () == ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF ||
119- e.code () == ErrorCodes::CANNOT_READ_ALL_DATA)
120- return ;
121-
122- throw ;
123- }
124- }
125- else
126- {
127- DirectoryIteratorPtr it;
128- try
129- {
130- it = iterateDirectory (local_path);
131- }
132- catch (const Exception & e)
133- {
134- // / Unfortunately in rare cases it can happen when files disappear
135- // / or can be empty in case of operation interruption (like cancelled metadata fetch)
136- if (e.code () == ErrorCodes::FILE_DOESNT_EXIST ||
137- e.code () == ErrorCodes::DIRECTORY_DOESNT_EXIST ||
138- e.code () == ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF ||
139- e.code () == ErrorCodes::CANNOT_READ_ALL_DATA)
140- return ;
141-
142- throw ;
143- }
144- catch (const fs::filesystem_error & e)
145- {
146- if (e.code () == std::errc::no_such_file_or_directory)
147- return ;
148- throw ;
149- }
150-
151- for (; it->isValid (); it->next ())
152- DiskObjectStorage::getRemotePathsRecursive (fs::path (local_path) / it->name (), paths_map, skip_predicate);
153- }
154- }
15590
15691bool DiskObjectStorage::exists (const String & path) const
15792{
0 commit comments