Uh oh!
There was an error while loading. Please reload this page.
[fix](compaction) Fix incorrect memory availability check in RowSourceBuffer during vertical compaction - #63152
Conversation
…eBuffer during vertical compaction Exception Log: thread_mem_tracker_mgr.h:248] alloc large memory: 4294967296, not in query or load, this is just a warning, not prevent memory alloc, stacktrace: 0# doris::ThreadMemTrackerMgr::consume(long, int) 1# Allocator<false, false, false, DefaultMemoryAllocator>::realloc_impl(void*, unsigned long, unsigned long, unsigned long) 2# void doris::vectorized::PODArrayBase<2ul, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 15ul>::reserve_for_next_size<>() 3# doris::vectorized::RowSourcesBuffer::append(std::vector<doris::vectorized::RowSource, std::allocator<doris::vectorized::RowSource> > const&) 4# doris::vectorized::VerticalHeapMergeIterator::next_batch(doris::vectorized::Block*) 5# doris::vectorized::VerticalBlockReader::_direct_next_block(doris::vectorized::Block*, bool*) 6# doris::vectorized::VerticalBlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*) 7# doris::Merger::vertical_compact_one_group(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, bool, std::vector<unsigned int, std::allocator<unsigned int> > const&, doris::vectorized::RowSourcesBuffer*, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, doris::Merger::Statistics*, std::vector<unsigned int, std::allocator<unsigned int> >, long, doris::CompactionSampleInfo*) 8# doris::Merger::vertical_merge_rowsets(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, long, doris::Merger::Statistics*) 9# doris::Compaction::merge_input_rowsets() 10# doris::CloudCompactionMixin::execute_compact_impl(long) 11# doris::CloudCompactionMixin::execute_compact() 12# doris::CloudCumulativeCompaction::execute_compact() 13# std::_Function_handler<void (), doris::CloudStorageEngine::_submit_cumulative_compaction_task(std::shared_ptr<doris::CloudTablet> const&)::$_2>::_M_invoke(std::_Any_data const&) 14# doris::ThreadPool::dispatch_thread() 15# doris::Thread::supervise_thread(void*) 16# ? 17# ? Reason: PaddedPODArray's `allocated_bytes` includes pad_left and pad_right, which are NOT usable for storing elements.
hello-stephen
commented
May 12, 2026
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
liutang123
commented
May 12, 2026
/review |
There was a problem hiding this comment.
Code review completed. I did not find any blocking issue in this PR.
Critical checkpoint conclusions:
- Goal and proof: The change targets RowSourcesBuffer spill-threshold correctness by using PODArray capacity/size rather than allocated bytes minus used bytes, which matches the actual reallocation condition. The added unit test exercises repeated appends, spill, flush, seek, and read-back.
- Scope: The code change is small and focused on the spill decision; no unrelated behavior changes observed.
- Concurrency: RowSourcesBuffer is used as per-compaction local state; this change adds no shared state or locking changes.
- Lifecycle/static initialization: No new static/global lifecycle concerns.
- Configuration: No new config item; existing vertical_compaction_max_row_source_memory_mb semantics are preserved.
- Compatibility/storage format: No serialized format or persistent metadata change.
- Parallel paths: The shared RowSourcesBuffer path is used by vertical compaction/segcompaction readers, so the fix applies at the common point.
- Tests: Unit coverage was added. I attempted
./run-be-ut.sh --run --filter=VerticalCompactionTest.TestRowSourcesBufferSpillThreshold, but the local runner environment failed during setup becausethirdparty/installed/bin/protocis missing, before the test could execute. - Observability/performance: No new expensive hot-path behavior beyond the existing spill branch; using capacity avoids the over-estimation that could cause unintended reallocation.
- Transaction/data correctness: No transaction, delete-bitmap, visible-version, or rowset lifecycle changes.
User focus: No additional user-provided review focus was specified.
liutang123
commented
May 12, 2026
run buildall |
hello-stephen
commented
May 12, 2026
TPC-H: Total hot run time: 29770 ms |
hello-stephen
commented
May 12, 2026
TPC-DS: Total hot run time: 171506 ms |
hello-stephen
commented
May 12, 2026
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
liutang123
commented
May 12, 2026
run p0 |
hello-stephen
commented
May 12, 2026
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
Uh oh!
There was an error while loading. Please reload this page.
…eBuffer during vertical compaction (#63152) Exception Log: ``` thread_mem_tracker_mgr.h:248] alloc large memory: 4294967296, not in query or load, this is just a warning, not prevent memory alloc, stacktrace: 0# doris::ThreadMemTrackerMgr::consume(long, int) 1# Allocator<false, false, false, DefaultMemoryAllocator>::realloc_impl(void*, unsigned long, unsigned long, unsigned long) 2# void doris::vectorized::PODArrayBase<2ul, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 15ul>::reserve_for_next_size<>() 3# doris::vectorized::RowSourcesBuffer::append(std::vector<doris::vectorized::RowSource, std::allocator<doris::vectorized::RowSource> > const&) 4# doris::vectorized::VerticalHeapMergeIterator::next_batch(doris::vectorized::Block*) 5# doris::vectorized::VerticalBlockReader::_direct_next_block(doris::vectorized::Block*, bool*) 6# doris::vectorized::VerticalBlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*) 7# doris::Merger::vertical_compact_one_group(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, bool, std::vector<unsigned int, std::allocator<unsigned int> > const&, doris::vectorized::RowSourcesBuffer*, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, doris::Merger::Statistics*, std::vector<unsigned int, std::allocator<unsigned int> >, long, doris::CompactionSampleInfo*) 8# doris::Merger::vertical_merge_rowsets(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, long, doris::Merger::Statistics*) 9# doris::Compaction::merge_input_rowsets() 10# doris::CloudCompactionMixin::execute_compact_impl(long) 11# doris::CloudCompactionMixin::execute_compact() 12# doris::CloudCumulativeCompaction::execute_compact() 13# std::_Function_handler<void (), doris::CloudStorageEngine::_submit_cumulative_compaction_task(std::shared_ptr<doris::CloudTablet> const&)::$_2>::_M_invoke(std::_Any_data const&) 14# doris::ThreadPool::dispatch_thread() 15# doris::Thread::supervise_thread(void*) 16# ? 17# ? ``` Reason: PaddedPODArray's `allocated_bytes` includes pad_left and pad_right, which are NOT usable for storing elements. Co-authored-by: liutang123 <liulijia1029@google.com>
…eBuffer during vertical compaction (#63152) Exception Log: ``` thread_mem_tracker_mgr.h:248] alloc large memory: 4294967296, not in query or load, this is just a warning, not prevent memory alloc, stacktrace: 0# doris::ThreadMemTrackerMgr::consume(long, int) 1# Allocator<false, false, false, DefaultMemoryAllocator>::realloc_impl(void*, unsigned long, unsigned long, unsigned long) 2# void doris::vectorized::PODArrayBase<2ul, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 15ul>::reserve_for_next_size<>() 3# doris::vectorized::RowSourcesBuffer::append(std::vector<doris::vectorized::RowSource, std::allocator<doris::vectorized::RowSource> > const&) 4# doris::vectorized::VerticalHeapMergeIterator::next_batch(doris::vectorized::Block*) 5# doris::vectorized::VerticalBlockReader::_direct_next_block(doris::vectorized::Block*, bool*) 6# doris::vectorized::VerticalBlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*) 7# doris::Merger::vertical_compact_one_group(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, bool, std::vector<unsigned int, std::allocator<unsigned int> > const&, doris::vectorized::RowSourcesBuffer*, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, doris::Merger::Statistics*, std::vector<unsigned int, std::allocator<unsigned int> >, long, doris::CompactionSampleInfo*) 8# doris::Merger::vertical_merge_rowsets(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, long, doris::Merger::Statistics*) 9# doris::Compaction::merge_input_rowsets() 10# doris::CloudCompactionMixin::execute_compact_impl(long) 11# doris::CloudCompactionMixin::execute_compact() 12# doris::CloudCumulativeCompaction::execute_compact() 13# std::_Function_handler<void (), doris::CloudStorageEngine::_submit_cumulative_compaction_task(std::shared_ptr<doris::CloudTablet> const&)::$_2>::_M_invoke(std::_Any_data const&) 14# doris::ThreadPool::dispatch_thread() 15# doris::Thread::supervise_thread(void*) 16# ? 17# ? ``` Reason: PaddedPODArray's `allocated_bytes` includes pad_left and pad_right, which are NOT usable for storing elements. Co-authored-by: liutang123 <liulijia1029@google.com>
…eBuffer during vertical compaction (apache#63152) Exception Log: ``` thread_mem_tracker_mgr.h:248] alloc large memory: 4294967296, not in query or load, this is just a warning, not prevent memory alloc, stacktrace: 0# doris::ThreadMemTrackerMgr::consume(long, int) 1# Allocator<false, false, false, DefaultMemoryAllocator>::realloc_impl(void*, unsigned long, unsigned long, unsigned long) 2# void doris::vectorized::PODArrayBase<2ul, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 15ul>::reserve_for_next_size<>() 3# doris::vectorized::RowSourcesBuffer::append(std::vector<doris::vectorized::RowSource, std::allocator<doris::vectorized::RowSource> > const&) 4# doris::vectorized::VerticalHeapMergeIterator::next_batch(doris::vectorized::Block*) 5# doris::vectorized::VerticalBlockReader::_direct_next_block(doris::vectorized::Block*, bool*) 6# doris::vectorized::VerticalBlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*) 7# doris::Merger::vertical_compact_one_group(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, bool, std::vector<unsigned int, std::allocator<unsigned int> > const&, doris::vectorized::RowSourcesBuffer*, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, doris::Merger::Statistics*, std::vector<unsigned int, std::allocator<unsigned int> >, long, doris::CompactionSampleInfo*) 8# doris::Merger::vertical_merge_rowsets(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, long, doris::Merger::Statistics*) 9# doris::Compaction::merge_input_rowsets() 10# doris::CloudCompactionMixin::execute_compact_impl(long) 11# doris::CloudCompactionMixin::execute_compact() 12# doris::CloudCumulativeCompaction::execute_compact() 13# std::_Function_handler<void (), doris::CloudStorageEngine::_submit_cumulative_compaction_task(std::shared_ptr<doris::CloudTablet> const&)::$_2>::_M_invoke(std::_Any_data const&) 14# doris::ThreadPool::dispatch_thread() 15# doris::Thread::supervise_thread(void*) 16# ? 17# ? ``` Reason: PaddedPODArray's `allocated_bytes` includes pad_left and pad_right, which are NOT usable for storing elements. Co-authored-by: liutang123 <liulijia1029@google.com>
### What problem does this PR solve? Issue Number: N/A Related PR: apache#63152, apache#53972 Problem Summary: Fix RowSourcesBuffer spill capacity accounting and 32-bit traversal narrowing that can crash vertical compaction for very large tablets. ### Release note Fix a BE crash during vertical compaction of very large tablets. ### Check List (For Author) - Test: Not run as requested; added a RowSourcesBuffer spill regression test - Behavior changed: Yes, RowSourcesBuffer spills before an append would exceed usable capacity - Does this need documentation: No
* [fix](be) Fix row source buffer overflow in vertical compaction ### What problem does this PR solve? Issue Number: N/A Related PR: apache#63152, apache#53972 Problem Summary: Fix RowSourcesBuffer spill capacity accounting and 32-bit traversal narrowing that can crash vertical compaction for very large tablets. ### Release note Fix a BE crash during vertical compaction of very large tablets. ### Check List (For Author) - Test: Not run as requested; added a RowSourcesBuffer spill regression test - Behavior changed: Yes, RowSourcesBuffer spills before an append would exceed usable capacity - Does this need documentation: No * [fix](be) Fix signed overflow in row source buffer memory threshold * [fix](be) Fix row source batch start after spill ### What problem does this PR solve? Issue Number: N/A Related PR: #83 Problem Summary: UNIQUE vertical compaction could reuse the previous row-source batch start when a spill produced the same buffered size, causing delete flags to be applied to stale positions. ### Release note Fix UNIQUE-key vertical compaction failures at equal-size row-source spill boundaries. ### Check List (For Author) - Test: Not run (per request; added BE unit-test coverage) - Behavior changed: Yes (derive the current row-source batch start from the total-size increment) - Does this need documentation: No
…eBuffer during vertical compaction (#63152) Exception Log: ``` thread_mem_tracker_mgr.h:248] alloc large memory: 4294967296, not in query or load, this is just a warning, not prevent memory alloc, stacktrace: 0# doris::ThreadMemTrackerMgr::consume(long, int) 1# Allocator<false, false, false, DefaultMemoryAllocator>::realloc_impl(void*, unsigned long, unsigned long, unsigned long) 2# void doris::vectorized::PODArrayBase<2ul, 4096ul, Allocator<false, false, false, DefaultMemoryAllocator>, 16ul, 15ul>::reserve_for_next_size<>() 3# doris::vectorized::RowSourcesBuffer::append(std::vector<doris::vectorized::RowSource, std::allocator<doris::vectorized::RowSource> > const&) 4# doris::vectorized::VerticalHeapMergeIterator::next_batch(doris::vectorized::Block*) 5# doris::vectorized::VerticalBlockReader::_direct_next_block(doris::vectorized::Block*, bool*) 6# doris::vectorized::VerticalBlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*) 7# doris::Merger::vertical_compact_one_group(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, bool, std::vector<unsigned int, std::allocator<unsigned int> > const&, doris::vectorized::RowSourcesBuffer*, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, doris::Merger::Statistics*, std::vector<unsigned int, std::allocator<unsigned int> >, long, doris::CompactionSampleInfo*) 8# doris::Merger::vertical_merge_rowsets(std::shared_ptr<doris::BaseTablet>, doris::ReaderType, doris::TabletSchema const&, std::vector<std::shared_ptr<doris::RowsetReader>, std::allocator<std::shared_ptr<doris::RowsetReader> > > const&, doris::RowsetWriter*, long, long, doris::Merger::Statistics*) 9# doris::Compaction::merge_input_rowsets() 10# doris::CloudCompactionMixin::execute_compact_impl(long) 11# doris::CloudCompactionMixin::execute_compact() 12# doris::CloudCumulativeCompaction::execute_compact() 13# std::_Function_handler<void (), doris::CloudStorageEngine::_submit_cumulative_compaction_task(std::shared_ptr<doris::CloudTablet> const&)::$_2>::_M_invoke(std::_Any_data const&) 14# doris::ThreadPool::dispatch_thread() 15# doris::Thread::supervise_thread(void*) 16# ? 17# ? ``` Reason: PaddedPODArray's `allocated_bytes` includes pad_left and pad_right, which are NOT usable for storing elements. Co-authored-by: liutang123 <liulijia1029@google.com>
Exception Log:
Reason: PaddedPODArray's
allocated_bytesincludes pad_left and pad_right, which are NOT usable for storing elements.What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)