Skip to content

Commit ea42c98

Browse files
authored
Merge pull request ClickHouse#62613 from ClickHouse/stream_system_remote_data_paths
Stream chunks from system.remote_data_paths
2 parents dfd3bbe + 5590b26 commit ea42c98

File tree

5 files changed

+318
-135
lines changed

5 files changed

+318
-135
lines changed

src/Disks/IDisk.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,6 @@ class IDisk : public Space
320320
{}
321321
};
322322

323-
virtual void getRemotePathsRecursive(
324-
const String &, std::vector<LocalPathWithObjectStoragePaths> &, const std::function<bool(const String &)> & /* skip_predicate */)
325-
{
326-
throw Exception(
327-
ErrorCodes::NOT_IMPLEMENTED,
328-
"Method `getRemotePathsRecursive() not implemented for disk: {}`",
329-
getDataSourceDescription().toString());
330-
}
331-
332323
/// Batch request to remove multiple files.
333324
/// May be much faster for blob storage.
334325
/// Second bool param is a flag to remove (true) or keep (false) shared data on S3.

src/Disks/ObjectStorages/DiskObjectStorage.cpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ namespace DB
2323
namespace 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

15691
bool DiskObjectStorage::exists(const String & path) const
15792
{

src/Disks/ObjectStorages/DiskObjectStorage.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ friend class DiskObjectStorageRemoteMetadataRestoreHelper;
4848

4949
StoredObjects getStorageObjects(const String & local_path) const override;
5050

51-
void getRemotePathsRecursive(
52-
const String & local_path,
53-
std::vector<LocalPathWithObjectStoragePaths> & paths_map,
54-
const std::function<bool(const String &)> & skip_predicate) override;
55-
5651
const std::string & getCacheName() const override { return object_storage->getCacheName(); }
5752

5853
std::optional<UInt64> getTotalSpace() const override { return {}; }

0 commit comments

Comments
 (0)