mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Backport #69256 to 24.8: Fix dropping of file cache in CHECK query in case of enabled transactions
This commit is contained in:
parent
8d8c4c7f34
commit
f48ba050ea
@ -95,22 +95,18 @@ UInt32 DataPartStorageOnDiskFull::getRefCount(const String & file_name) const
|
||||
return volume->getDisk()->getRefCount(fs::path(root_path) / part_dir / file_name);
|
||||
}
|
||||
|
||||
std::string DataPartStorageOnDiskFull::getRemotePath(const std::string & file_name, bool if_exists) const
|
||||
std::vector<std::string> DataPartStorageOnDiskFull::getRemotePaths(const std::string & file_name) const
|
||||
{
|
||||
const std::string path = fs::path(root_path) / part_dir / file_name;
|
||||
auto objects = volume->getDisk()->getStorageObjects(path);
|
||||
|
||||
if (objects.empty() && if_exists)
|
||||
return "";
|
||||
std::vector<std::string> remote_paths;
|
||||
remote_paths.reserve(objects.size());
|
||||
|
||||
if (objects.size() != 1)
|
||||
{
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
"One file must be mapped to one object on blob storage by path {} in MergeTree tables, have {}.",
|
||||
path, objects.size());
|
||||
}
|
||||
for (const auto & object : objects)
|
||||
remote_paths.push_back(object.remote_path);
|
||||
|
||||
return objects[0].remote_path;
|
||||
return remote_paths;
|
||||
}
|
||||
|
||||
String DataPartStorageOnDiskFull::getUniqueId() const
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
Poco::Timestamp getFileLastModified(const String & file_name) const override;
|
||||
size_t getFileSize(const std::string & file_name) const override;
|
||||
UInt32 getRefCount(const std::string & file_name) const override;
|
||||
std::string getRemotePath(const std::string & file_name, bool if_exists) const override;
|
||||
std::vector<std::string> getRemotePaths(const std::string & file_name) const override;
|
||||
String getUniqueId() const override;
|
||||
|
||||
std::unique_ptr<ReadBufferFromFileBase> readFile(
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
virtual UInt32 getRefCount(const std::string & file_name) const = 0;
|
||||
|
||||
/// Get path on remote filesystem from file name on local filesystem.
|
||||
virtual std::string getRemotePath(const std::string & file_name, bool if_exists) const = 0;
|
||||
virtual std::vector<std::string> getRemotePaths(const std::string & file_name) const = 0;
|
||||
|
||||
virtual UInt64 calculateTotalSizeOnDisk() const = 0;
|
||||
|
||||
|
@ -391,16 +391,8 @@ IMergeTreeDataPart::Checksums checkDataPart(
|
||||
auto file_name = it->name();
|
||||
if (!data_part_storage.isDirectory(file_name))
|
||||
{
|
||||
const bool is_projection_part = data_part->isProjectionPart();
|
||||
auto remote_path = data_part_storage.getRemotePath(file_name, /* if_exists */is_projection_part);
|
||||
if (remote_path.empty())
|
||||
{
|
||||
chassert(is_projection_part);
|
||||
throw Exception(
|
||||
ErrorCodes::BROKEN_PROJECTION,
|
||||
"Remote path for {} does not exist for projection path. Projection {} is broken",
|
||||
file_name, data_part->name);
|
||||
}
|
||||
auto remote_paths = data_part_storage.getRemotePaths(file_name);
|
||||
for (const auto & remote_path : remote_paths)
|
||||
cache.removePathIfExists(remote_path, FileCache::getCommonUser().user_id);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user