diff --git a/src/Interpreters/Cache/FileSegment.cpp b/src/Interpreters/Cache/FileSegment.cpp index 1b7fe54a769..7b82c58080c 100644 --- a/src/Interpreters/Cache/FileSegment.cpp +++ b/src/Interpreters/Cache/FileSegment.cpp @@ -381,7 +381,7 @@ void FileSegment::write(const char * from, size_t size, size_t offset) const auto file_size = fs::file_size(file_segment_path); chassert(downloaded_size <= file_size); chassert(reserved_size >= file_size); - chassert(file_size <= range().right + 1); + chassert(file_size <= range().size()); if (downloaded_size != file_size) downloaded_size = file_size; } diff --git a/src/Interpreters/Cache/Metadata.cpp b/src/Interpreters/Cache/Metadata.cpp index 9dff77e2af8..4794d1b3264 100644 --- a/src/Interpreters/Cache/Metadata.cpp +++ b/src/Interpreters/Cache/Metadata.cpp @@ -370,8 +370,8 @@ KeyMetadata::iterator LockedKey::removeFileSegment(size_t offset, const FileSegm bool exists = fs::exists(path); if (exists) { - LOG_TEST(log, "Removed file segment at path: {}", path); fs::remove(path); + LOG_TEST(log, "Removed file segment at path: {}", path); } else if (file_segment->downloaded_size) throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected path {} to exist");