diff --git a/contrib/libcxxabi-cmake/CMakeLists.txt b/contrib/libcxxabi-cmake/CMakeLists.txt index 4ad7b8861db..ac362d0296e 100644 --- a/contrib/libcxxabi-cmake/CMakeLists.txt +++ b/contrib/libcxxabi-cmake/CMakeLists.txt @@ -22,18 +22,6 @@ set(SRCS "${LIBCXXABI_SOURCE_DIR}/src/stdlib_typeinfo.cpp" ) -CHECK_CXX_SOURCE_COMPILES(" - static thread_local int foo; - int main() { - return 0; - } -" HAS_THREAD_LOCAL) - -set(COMPILE_DEFINITIONS "-D_LIBCPP_BUILDING_LIBRARY") -if (HAS_THREAD_LOCAL) - set(COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} -DHAS_THREAD_LOCAL") -endif() - add_library(cxxabi ${SRCS}) set_target_properties(cxxabi PROPERTIES FOLDER "contrib/libcxxabi-cmake") @@ -45,7 +33,7 @@ target_include_directories(cxxabi SYSTEM BEFORE PRIVATE $ PRIVATE $ ) -target_compile_definitions(cxxabi PRIVATE ${COMPILE_DEFINITIONS}) +target_compile_definitions(cxxabi PRIVATE -D_LIBCPP_BUILDING_LIBRARY -DHAS_THREAD_LOCAL) target_compile_options(cxxabi PRIVATE -nostdinc++ -fno-sanitize=undefined -Wno-macro-redefined) # If we don't disable UBSan, infinite recursion happens in dynamic_cast. target_link_libraries(cxxabi PUBLIC unwind) diff --git a/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp b/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp index 9c9e625efaf..6c789210be2 100644 --- a/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp +++ b/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp @@ -1087,12 +1087,11 @@ bool CachedOnDiskReadBufferFromFile::nextImplStep() first_offset, file_segments->toString()); - if (file_offset_of_buffer_end > current_read_range.right) - completeFileSegmentAndGetNext(); - /// Release buffer a little bit earlier. if (read_until_position == file_offset_of_buffer_end) implementation_buffer.reset(); + else if (file_offset_of_buffer_end > current_read_range.right) + completeFileSegmentAndGetNext(); return result; } @@ -1294,7 +1293,7 @@ static bool isRangeContainedInSegments(size_t left, size_t right, const FileSegm bool CachedOnDiskReadBufferFromFile::isContentCached(size_t offset, size_t size) { if (!initialized) - initialize(file_offset_of_buffer_end, getTotalSizeToRead()); + initialize(); return isRangeContainedInSegments(offset, std::min(offset + size, read_until_position) - 1, file_segments); } diff --git a/src/Interpreters/Cache/FileSegment.h b/src/Interpreters/Cache/FileSegment.h index 9a4bbf69c5a..3a73fc27ba9 100644 --- a/src/Interpreters/Cache/FileSegment.h +++ b/src/Interpreters/Cache/FileSegment.h @@ -140,8 +140,6 @@ public: bool contains(const Range & other) const { return contains(other.left) && contains(other.right); } String toString() const { return fmt::format("[{}, {}]", std::to_string(left), std::to_string(right)); } - - bool contains(size_t offset) const { return left <= offset && offset <= right; } }; static String getCallerId();