mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Remove redundant change
This commit is contained in:
parent
f7dc28984c
commit
faf783e66f
@ -160,10 +160,10 @@ void EvictionCandidates::evict()
|
||||
bool EvictionCandidates::needFinalize() const
|
||||
{
|
||||
/// finalize() does the following:
|
||||
/// 1. Release space holders in case they were added.
|
||||
/// (Space holder are created if some space needs to be hold
|
||||
/// 1. Release space holder in case if exists.
|
||||
/// (Space holder is created if some space needs to be hold
|
||||
/// while were are doing eviction from filesystem without which is done without a lock)
|
||||
/// Note: this step is not needed in case dynamic cache resize,
|
||||
/// Note: this step is not needed in case of dynamic cache resize,
|
||||
/// because space holders are not used.
|
||||
/// 2. Delete queue entries from IFileCachePriority queue.
|
||||
/// These queue entries were invalidated during lock-free eviction phase,
|
||||
@ -171,14 +171,14 @@ bool EvictionCandidates::needFinalize() const
|
||||
/// Note: this step can in fact be removed as we do this cleanup
|
||||
/// (removal of invalidated queue entries)
|
||||
/// when we iterate the queue and see such entries along the way.
|
||||
/// Note: this step is omitted in case dynamic cache resize,
|
||||
/// Note: this step is not needed in case of dynamic cache resize,
|
||||
/// because we remove queue entries in advance, before actual eviction.
|
||||
/// 3. Execute on_finalize functions.
|
||||
/// These functions are set only for SLRU eviction policy,
|
||||
/// where we need to do additional work after eviction.
|
||||
/// Note: this step is not needed in case dynamic cache resize even for SLRU.
|
||||
/// Note: this step is not needed in case of dynamic cache resize even for SLRU.
|
||||
|
||||
return !on_finalize.empty() || !queue_entries_to_invalidate.empty() || !hold_space.empty();
|
||||
return !on_finalize.empty() || !queue_entries_to_invalidate.empty();
|
||||
}
|
||||
|
||||
void EvictionCandidates::finalize(
|
||||
@ -190,7 +190,8 @@ void EvictionCandidates::finalize(
|
||||
/// Release the hold space. It was hold only for the duration of evict() phase,
|
||||
/// now we can release. It might also be needed for on_finalize func,
|
||||
/// so release the space it firtst.
|
||||
hold_space.clear();
|
||||
if (hold_space)
|
||||
hold_space.reset();
|
||||
|
||||
while (!queue_entries_to_invalidate.empty())
|
||||
{
|
||||
@ -216,14 +217,16 @@ void EvictionCandidates::finalize(
|
||||
on_finalize.clear();
|
||||
}
|
||||
|
||||
void EvictionCandidates::addSpaceHolder(
|
||||
void EvictionCandidates::setSpaceHolder(
|
||||
size_t size,
|
||||
size_t elements,
|
||||
IFileCachePriority & priority,
|
||||
const CachePriorityGuard::Lock & lock)
|
||||
{
|
||||
/// Currently we can have more than one space holder during dynamic cache resize.
|
||||
hold_space.emplace_back(std::make_unique<IFileCachePriority::HoldSpace>(size, elements, priority, lock));
|
||||
if (hold_space)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Space hold is already set");
|
||||
else
|
||||
hold_space = std::make_unique<IFileCachePriority::HoldSpace>(size, elements, priority, lock);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
|
||||
auto end() const { return candidates.end(); }
|
||||
|
||||
void addSpaceHolder(
|
||||
void setSpaceHolder(
|
||||
size_t size,
|
||||
size_t elements,
|
||||
IFileCachePriority & priority,
|
||||
@ -56,7 +56,7 @@ private:
|
||||
std::vector<IFileCachePriority::IteratorPtr> queue_entries_to_invalidate;
|
||||
bool removed_queue_entries = false;
|
||||
|
||||
std::vector<IFileCachePriority::HoldSpacePtr> hold_space;
|
||||
IFileCachePriority::HoldSpacePtr hold_space;
|
||||
|
||||
LoggerPtr log;
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ bool LRUFileCachePriority::collectCandidatesForEviction(
|
||||
: 0;
|
||||
|
||||
if (hold_size || hold_elements)
|
||||
res.addSpaceHolder(hold_size, hold_elements, *this, lock);
|
||||
res.setSpaceHolder(hold_size, hold_elements, *this, lock);
|
||||
}
|
||||
|
||||
// LOG_TEST(log, "Collected {} candidates for eviction (total size: {}). "
|
||||
|
@ -294,7 +294,7 @@ bool SLRUFileCachePriority::collectCandidatesForEviction(
|
||||
stat += protected_stat;
|
||||
|
||||
LOG_TEST(log, "Collected {} to evict from protected queue "
|
||||
"with total size: {} (result: {})"
|
||||
"with total size: {} (result: {}). "
|
||||
"Desired size: {}, desired elements count: {}, current state: {}",
|
||||
protected_stat.total_stat.releasable_count,
|
||||
protected_stat.total_stat.releasable_size, res.size(),
|
||||
|
Loading…
Reference in New Issue
Block a user