Repository navigation
fix(cpp): return E_INVALID_ARG when a result block cannot hold one row - #1149
Merged
Merged
Conversation
A table query with a TimeBetween filter and a tsblock_max_memory_ smaller than one result row spun forever in TsFileSeriesScanIterator::get_next: an E_OK with 0 rows was retried while has_more_data() stayed true with no progress. Detect an unusable block (zero max rows) before decoding and surface E_INVALID_ARG, matching the serial decode paths.
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 table query with a
TimeBetweenfilter and atsblock_max_memory_smaller than one result row spun forever: the firstResultSet::next()never returned (100% CPU).The hang was in
TsFileSeriesScanIterator::get_next. When the outputTsBlockcannot hold a single row,AlignedChunkReader::get_next_pagereportsE_OKwith 0 rows whilehas_more_data()stays true, so the 0-row retry branchcontinues without any progress and loops forever.Fix
Before decoding,
TsFileSeriesScanIterator::get_nextnow checks that the output block is usable:E_OOM;max_row_count == 0(memory budget smaller than one row) returnsE_INVALID_ARG.This matches the existing behavior of the single-value and serial multi-value decode paths, which already convert the same "empty block" condition to
E_INVALID_ARG.Test
Added
AlignedFieldFilterRegressionTest.TimeBetweenFilterUnusableCapacityReportsError: a 10-tag / 100-field table queried through aTimeBetweenfilter withtsblock_max_memory_ = 8, asserting the firstnext()returnsE_INVALID_ARGinstead of hanging (covered in both parallel and row/batch read modes).