From 64881138cc1d3d0919bf436493dab84777207262 Mon Sep 17 00:00:00 2001 From: kssenii Date: Wed, 13 Nov 2024 12:31:09 +0100 Subject: [PATCH] More assertion --- src/Interpreters/Cache/FileSegment.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Interpreters/Cache/FileSegment.cpp b/src/Interpreters/Cache/FileSegment.cpp index 9a42bfd45a5..f002443f07c 100644 --- a/src/Interpreters/Cache/FileSegment.cpp +++ b/src/Interpreters/Cache/FileSegment.cpp @@ -876,7 +876,12 @@ bool FileSegment::assertCorrectnessUnlocked(const FileSegmentGuard::Lock & lock) chassert(downloaded_size == reserved_size); chassert(downloaded_size == range().size()); chassert(downloaded_size > 0); - chassert(fs::file_size(getPath()) > 0); + + auto file_size = fs::file_size(getPath()); + UNUSED(file_size); + + chassert(file_size == range().size()); + chassert(downloaded_size == range().size()); chassert(queue_iterator || on_delayed_removal); check_iterator(queue_iterator); @@ -898,7 +903,13 @@ bool FileSegment::assertCorrectnessUnlocked(const FileSegmentGuard::Lock & lock) chassert(reserved_size >= downloaded_size); chassert(downloaded_size > 0); - chassert(fs::file_size(getPath()) > 0); + + auto file_size = fs::file_size(getPath()); + UNUSED(file_size); + + chassert(file_size > 0); + chassert(file_size <= range().size()); + chassert(downloaded_size <= range().size()); chassert(queue_iterator); check_iterator(queue_iterator);