mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Move assertion one layer higher
This commit is contained in:
parent
d4823eed12
commit
0adfee3eca
@ -28,6 +28,7 @@ CachedReadBufferFromRemoteFS::CachedReadBufferFromRemoteFS(
|
||||
FileCachePtr cache_,
|
||||
RemoteFSFileReaderCreator remote_file_reader_creator_,
|
||||
const ReadSettings & settings_,
|
||||
const String & query_id_,
|
||||
size_t read_until_position_)
|
||||
: SeekableReadBuffer(nullptr, 0)
|
||||
#ifndef NDEBUG
|
||||
@ -41,11 +42,9 @@ CachedReadBufferFromRemoteFS::CachedReadBufferFromRemoteFS(
|
||||
, settings(settings_)
|
||||
, read_until_position(read_until_position_)
|
||||
, remote_file_reader_creator(remote_file_reader_creator_)
|
||||
, query_id(CurrentThread::getQueryId())
|
||||
, query_id(query_id_)
|
||||
, enable_logging(!query_id.empty() && settings_.enable_filesystem_cache_log)
|
||||
{
|
||||
assert(query_id.empty()
|
||||
|| CurrentThread::isInitialized() && CurrentThread::get().getQueryContext() != nullptr);
|
||||
}
|
||||
|
||||
void CachedReadBufferFromRemoteFS::appendFilesystemCacheLog(
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
FileCachePtr cache_,
|
||||
RemoteFSFileReaderCreator remote_file_reader_creator_,
|
||||
const ReadSettings & settings_,
|
||||
const String & query_id_,
|
||||
size_t read_until_position_);
|
||||
|
||||
bool nextImpl() override;
|
||||
|
@ -62,7 +62,7 @@ SeekableReadBufferPtr ReadBufferFromS3Gather::createImplementationBufferImpl(con
|
||||
if (with_cache)
|
||||
{
|
||||
return std::make_shared<CachedReadBufferFromRemoteFS>(
|
||||
remote_path, settings.remote_fs_cache, remote_file_reader_creator, settings, read_until_position ? read_until_position : file_size);
|
||||
remote_path, settings.remote_fs_cache, remote_file_reader_creator, settings, query_id, read_until_position ? read_until_position : file_size);
|
||||
}
|
||||
|
||||
return remote_file_reader_creator();
|
||||
@ -103,13 +103,16 @@ ReadBufferFromRemoteFSGather::ReadBufferFromRemoteFSGather(
|
||||
, common_path_prefix(common_path_prefix_)
|
||||
, blobs_to_read(blobs_to_read_)
|
||||
, settings(settings_)
|
||||
, log(&Poco::Logger::get("ReadBufferFromRemoteFSGather"))
|
||||
, query_id(CurrentThread::getQueryId())
|
||||
, log(&Poco::Logger::get("ReadBufferFromRemoteFSGather"))
|
||||
, enable_cache_log(!query_id.empty() && settings.enable_filesystem_cache_log)
|
||||
{
|
||||
with_cache = settings.remote_fs_cache
|
||||
&& settings.enable_filesystem_cache
|
||||
&& (!IFileCache::isReadOnly() || settings.read_from_filesystem_cache_if_exists_otherwise_bypass_cache);
|
||||
|
||||
assert(query_id.empty()
|
||||
|| CurrentThread::isInitialized() && CurrentThread::get().getQueryContext() != nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +72,8 @@ protected:
|
||||
|
||||
bool with_cache;
|
||||
|
||||
String query_id;
|
||||
|
||||
private:
|
||||
SeekableReadBufferPtr createImplementationBuffer(const String & path, size_t file_size);
|
||||
|
||||
@ -100,8 +102,6 @@ private:
|
||||
|
||||
Poco::Logger * log;
|
||||
|
||||
String query_id;
|
||||
|
||||
size_t total_bytes_read_from_current_file = 0;
|
||||
|
||||
bool enable_cache_log = false;
|
||||
|
Loading…
Reference in New Issue
Block a user