mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
Add assertions
This commit is contained in:
parent
97b3474332
commit
64712601a4
@ -113,6 +113,9 @@ LRUFileCachePriority::LRUQueue::iterator LRUFileCachePriority::remove(LRUQueue::
|
|||||||
|
|
||||||
void LRUFileCachePriority::updateSize(int64_t size)
|
void LRUFileCachePriority::updateSize(int64_t size)
|
||||||
{
|
{
|
||||||
|
chassert(size != 0);
|
||||||
|
chassert(size > 0 || state->current_size >= size_t(-size));
|
||||||
|
|
||||||
state->current_size += size;
|
state->current_size += size;
|
||||||
CurrentMetrics::add(CurrentMetrics::FilesystemCacheSize, size);
|
CurrentMetrics::add(CurrentMetrics::FilesystemCacheSize, size);
|
||||||
}
|
}
|
||||||
@ -390,6 +393,7 @@ void LRUFileCachePriority::LRUIterator::incrementSize(size_t size, const CacheGu
|
|||||||
"Increment size with {} in LRU queue for key: {}, offset: {}, previous size: {}",
|
"Increment size with {} in LRU queue for key: {}, offset: {}, previous size: {}",
|
||||||
size, entry->key, entry->offset, entry->size);
|
size, entry->key, entry->offset, entry->size);
|
||||||
|
|
||||||
|
chassert(size);
|
||||||
cache_priority->updateSize(size);
|
cache_priority->updateSize(size);
|
||||||
entry->size += size;
|
entry->size += size;
|
||||||
}
|
}
|
||||||
@ -404,6 +408,9 @@ void LRUFileCachePriority::LRUIterator::decrementSize(size_t size)
|
|||||||
"Decrement size with {} in LRU queue for key: {}, offset: {}, previous size: {}",
|
"Decrement size with {} in LRU queue for key: {}, offset: {}, previous size: {}",
|
||||||
size, entry->key, entry->offset, entry->size);
|
size, entry->key, entry->offset, entry->size);
|
||||||
|
|
||||||
|
chassert(size);
|
||||||
|
chassert(entry->size >= size);
|
||||||
|
|
||||||
cache_priority->updateSize(-size);
|
cache_priority->updateSize(-size);
|
||||||
entry->size -= size;
|
entry->size -= size;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user