Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoupling local cache function and cache algorithm #38048

Merged
Prev Previous commit
Next Next commit
fix
  • Loading branch information
KinderRiven committed Aug 10, 2022
commit fbaa70b3130e1ae66ec0fdefed5f2921dc55c9cf
4 changes: 2 additions & 2 deletions src/Common/FileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static bool isQueryInitialized()
{
return CurrentThread::isInitialized()
&& CurrentThread::get().getQueryContext()
&& CurrentThread::getQueryId().size != 0;
&& CurrentThread::getQueryId().size() != 0;
}

bool FileCache::isReadOnly()
Expand All @@ -82,7 +82,7 @@ FileCache::QueryContextPtr FileCache::getCurrentQueryContext(std::lock_guard<std
if (!isQueryInitialized())
return nullptr;

return getQueryContext(CurrentThread::getQueryId().toString(), cache_lock);
return getQueryContext(std::string(CurrentThread::getQueryId()), cache_lock);
}

FileCache::QueryContextPtr FileCache::getQueryContext(const String & query_id, std::lock_guard<std::mutex> & /* cache_lock */)
Expand Down
2 changes: 1 addition & 1 deletion src/Disks/ObjectStorages/LocalObjectStorage.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <Disks/ObjectStorages/LocalObjectStorage.h>

#include <Disks/ObjectStorages/DiskObjectStorageCommon.h>
#include <Common/IFileCache.h>
#include <Common/FileCache.h>
#include <Common/FileCacheFactory.h>
#include <Common/filesystemHelpers.h>
#include <Common/logger_useful.h>
Expand Down
4 changes: 2 additions & 2 deletions src/Disks/ObjectStorages/S3/S3ObjectStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void S3ObjectStorage::removeCacheIfExists(const std::string & path_key)
if (!cache || path_key.empty())
return;

IFileCache::Key key = cache->hash(path_key);
FileCache::Key key = cache->hash(path_key);
cache->removeIfExists(key);
}

Expand Down Expand Up @@ -500,7 +500,7 @@ ReadSettings S3ObjectStorage::patchSettings(const ReadSettings & read_settings)
ReadSettings settings{read_settings};
if (cache)
{
if (IFileCache::isReadOnly())
if (FileCache::isReadOnly())
settings.read_from_filesystem_cache_if_exists_otherwise_bypass_cache = true;

settings.remote_fs_cache = cache;
Expand Down