fix(engine): an empty visible set is not the absence of one - #156
Merged
Conversation
install_aof_bitmap() turns the AOF bitmap into the recno sequence that goto_top / goto_bottom / skip walk. All three gated on `!recno_sequence_.empty()`, which reads "the visible set is empty" as "no sequence was installed" -- so a filter matching NO record fell through to the active-index branch of the walk. That branch positions from the index and never consults filter_ (the sequence is what is supposed to carry the AOF there). Net effect: a filter selecting nothing returned the WHOLE table. Only while an index was open, which is what made it look arbitrary: with no active order the walk reaches the plain record path, which does apply filter_, and the same filter correctly showed nothing. The same conflation covered the SQL cursors that install a sequence for ORDER BY / WHERE: a query yielding no rows walked the base table instead of reporting Eof. Table now tracks whether a sequence was INSTALLED separately from whether it has entries. The three navigation gates test that flag; installed-but-empty means Limbo for goto_top / goto_bottom and Bof / Eof for skip. has_recno_sequence() keeps its "non-empty" meaning -- the SQL layer uses it to ask whether there are rows to post-process for DISTINCT / LIMIT / OFFSET, which is a different question. Test: abi_aof_empty_result_test -- a filter matching no row hides everything both before and after the tag is created, and the table comes back in full once the AOF is cleared.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
FiveTechSoft
added a commit
that referenced
this pull request
Aug 2, 2026
install_aof_bitmap() produced an empty recno_sequence_ for an all-false bitmap, and goto_top/goto_bottom/skip treated it as 'no sequence', navigating in index order without consulting filter_ — an AOF matching zero rows returned the whole table. New recno_sequence_active_ flag gates navigation; empty-but-active means Limbo/Eof. Conflict in skip() resolved keeping main's dirty-settle. Includes abi_aof_empty_result_test. # Conflicts: # tests/CMakeLists.txt
Owner
|
Landed on main — verified green (suite 1273/1273, your new tests included). Thank you! |
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.
install_aof_bitmap()turns the AOF bitmap into the recno sequence thatgoto_top/goto_bottom/skipwalk. All three gated on!recno_sequence_.empty(), which reads "the visible set is empty" as "no sequence was installed" — so a filter matching no record fell through to the active-index branch of the walk. That branch positions from the index and never consultsfilter_(the sequence is what is supposed to carry the AOF there).Net effect: a filter selecting nothing returned the whole table.
Only while an index was open, which is what made it look arbitrary: with no active order the walk reaches the plain record path, which does apply
filter_, and the same filter correctly showed nothing.The same conflation covered the SQL cursors that install a sequence for
ORDER BY/WHERE: a query yielding no rows walked the base table instead of reporting Eof.Fix
Tablenow tracks whether a sequence was INSTALLED separately from whether it has entries. The three navigation gates test that flag; installed-but-empty means Limbo forgoto_top/goto_bottomand Bof / Eof forskip.has_recno_sequence()keeps its "non-empty" meaning — the SQL layer uses it to ask whether there are rows to post-process for DISTINCT / LIMIT / OFFSET, which is a different question.Test
abi_aof_empty_result_test— a filter matching no row hides everything both before and after the tag is created, and the table comes back in full once the AOF is cleared.Full suite on top of
main: 1249/1252, the 3 failures being the pre-existingRemote:locking / filesystem cases over embedded TCP, which fail identically with and without this change.Found while auditing the consumers of the key-comparison primitives after #154 / #155.