Repository navigation
fix(cpp): surface E_INVALID_ARG for non-aligned tree scan with sub-row TsBlock capacity - #1154
Merged
Merged
Conversation
…w TsBlock capacity A non-aligned (tree) scan with a TsBlock capacity smaller than a single row spins forever in the query stage. With a 16-byte row and an 8-byte capacity, TsBlock::init() computes max_row_count_ == 0, so the per-type decode loops report E_OVERFLOW before appending anything; decode_cur_page_data() rewrites that to E_OK with zero rows, and the scan iterator retries the same page endlessly. Detect the zero-row overflow and return E_INVALID_ARG instead, matching the aligned path's handling of an unusable block capacity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A non-aligned (tree) query with a TsBlock capacity smaller than a single row spins forever in the query stage.
With a 16-byte row (time INT64 + value INT64) and an 8-byte capacity,
TsBlock::init()computesmax_row_count_ == 0. The per-type decode loops (i32_DECODE_TV_BATCH, etc.) then reportE_OVERFLOWbefore appending anything,decode_cur_page_data()rewrites that toE_OKwith zero rows, andTsFileSeriesScanIterator::get_next()retries the same page endlessly (has_more_data()stays true because the page was never consumed).Fix
ChunkReader::decode_tv_buf_into_tsblock_by_datatype()now detects the zero-row overflow (the destination block cannot hold even one row) and returnsE_INVALID_ARGinstead of letting it becomeE_OKwith zero rows. This matches the aligned path, which already reports an error for an unusable block capacity.Test
Added
TsFileReaderTest.NonAlignedTreeSmallTsBlockDoesNotHang: a non-aligned INT64 series read through a scan iterator withtsblock_max_memory_ = 8must returnE_INVALID_ARGrather than looping.