From 4cb7ac57e42d89499e1e89112d5e2241244bf132 Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Mon, 2 Jan 2023 11:02:27 +0000 Subject: [PATCH] Small renaming for more clarity --- src/Interpreters/Cache/QueryResultCache.cpp | 18 +++++++++--------- src/Interpreters/Cache/QueryResultCache.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Interpreters/Cache/QueryResultCache.cpp b/src/Interpreters/Cache/QueryResultCache.cpp index a5cacfea55b..07c79ac61cc 100644 --- a/src/Interpreters/Cache/QueryResultCache.cpp +++ b/src/Interpreters/Cache/QueryResultCache.cpp @@ -180,8 +180,8 @@ try return res; }; - auto entry = std::make_shared(to_single_chunk(chunks)); - new_entry_size_in_bytes = entry->allocatedBytes(); // updated because compression potentially affects the size of the single chunk vs the aggregate size of individual chunks + auto result = std::make_shared(to_single_chunk(partial_results)); + new_entry_size_in_bytes = result->allocatedBytes(); // updated because compression potentially affects the size of the single chunk vs the aggregate size of individual chunks std::lock_guard lock(mutex); @@ -212,13 +212,13 @@ try /// Insert or replace if enough space if (sufficient_space_in_cache()) { - cache_size_in_bytes += entry->allocatedBytes(); + cache_size_in_bytes += result->allocatedBytes(); if (auto it = cache.find(key); it != cache.end()) cache_size_in_bytes -= it->second->allocatedBytes(); /// key replacement - /// cache[key] = entry; /// does no replacement for unclear reasons + /// cache[key] = result; /// does no replacement for unclear reasons cache.erase(key); - cache[key] = entry; + cache[key] = result; LOG_DEBUG(&Poco::Logger::get("QueryResultCache"), "Stored result of query {}", key.queryStringFromAst()); } @@ -227,15 +227,15 @@ catch (const std::exception &) { } -void QueryResultCache::Writer::buffer(Chunk && chunk) +void QueryResultCache::Writer::buffer(Chunk && partial_result) { if (skip_insert) return; - chunks.emplace_back(std::move(chunk)); + partial_results.emplace_back(std::move(partial_result)); - new_entry_size_in_bytes += chunks.back().allocatedBytes(); - new_entry_size_in_rows += chunks.back().getNumRows(); + new_entry_size_in_bytes += partial_results.back().allocatedBytes(); + new_entry_size_in_rows += partial_results.back().getNumRows(); if ((new_entry_size_in_bytes > max_entry_size_in_bytes) || (new_entry_size_in_rows > max_entry_size_in_rows)) skip_insert = true; diff --git a/src/Interpreters/Cache/QueryResultCache.h b/src/Interpreters/Cache/QueryResultCache.h index d511958a150..1b8f6d28cf4 100644 --- a/src/Interpreters/Cache/QueryResultCache.h +++ b/src/Interpreters/Cache/QueryResultCache.h @@ -80,7 +80,7 @@ public: { public: ~Writer(); - void buffer(Chunk && chunk); + void buffer(Chunk && partial_result); private: std::mutex & mutex; Cache & cache TSA_GUARDED_BY(mutex); @@ -94,7 +94,7 @@ public: const size_t max_entry_size_in_rows; const std::chrono::time_point query_start_time = std::chrono::system_clock::now(); /// Writer construction/destruction coincides with query start/end const std::chrono::milliseconds min_query_duration; - Chunks chunks; + Chunks partial_results; std::atomic skip_insert = false; Writer(std::mutex & mutex_, Cache & cache_, const Key & key_,