Skip to content

fix(engine): walk past stale index entries instead of raising 5000 - #135

Merged
FiveTechSoft merged 1 commit into
FiveTechSoft:mainfrom
russimicro:fix/stale-index-walk-after-pack
Jul 29, 2026
Merged

fix(engine): walk past stale index entries instead of raising 5000#135
FiveTechSoft merged 1 commit into
FiveTechSoft:mainfrom
russimicro:fix/stale-index-walk-after-pack

Conversation

@russimicro

Copy link
Copy Markdown
Collaborator

PACK leaves bound tags stale on purpose (Clipper semantics: the caller REINDEXes), and a tag that was unbound at PACK time and reopened afterwards still maps keys to recnos above the compacted record count.

goto_top / goto_bottom / skip loaded those recnos and propagated the driver's 5000 "record number out of range", so a browse over such a tag died instead of navigating. Native ADSCDX walks past them.

They now treat a 5000 from load_record_ like a deleted row and step to the next entry; any other error still propagates. In skip with SET DELETED OFF the probe is gated on recno > record_count, so the common path does no extra I/O.

Test: abi_stale_index_walk_test — build a tag, close it, delete two rows, PACK, reopen the now-stale tag and walk it: GotoTop / GetDouble / Skip must all succeed and visit exactly the surviving rows.

Found while running a Harbour/FiveWin ERP's reindex cycle on OpenADS.

Suite: 1178/1190 — the same 12 pre-existing SQL-parser (7200) failures as pristine v1.8.31, verified on this branch in isolation (MSVC x64 Release).

🤖 Generated with Claude Code

PACK leaves bound tags stale on purpose (Clipper semantics: the caller
REINDEXes), and a tag that was unbound at PACK time and reopened afterwards
still maps keys to recnos above the compacted record count.

goto_top / goto_bottom / skip loaded those recnos and propagated the
driver's 5000 'record number out of range', so a browse over such a tag died
instead of navigating. Native ADSCDX walks past them.

They now treat a 5000 from load_record_ like a deleted row and step to the
next entry; any other error still propagates. In skip with SET DELETED OFF
the probe is gated on recno > record_count, so the common path does no extra
I/O.

New test abi_stale_index_walk_test: build a tag, close it, delete two rows,
PACK, reopen the now-stale tag and walk it — GotoTop / GetDouble / Skip must
all succeed and visit exactly the surviving rows.

Found while running a Harbour/FiveWin ERP's reindex cycle on OpenADS.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@FiveTechSoft
FiveTechSoft merged commit 58b5940 into FiveTechSoft:main Jul 29, 2026
1 of 11 checks passed
FiveTechSoft added a commit that referenced this pull request Jul 29, 2026
ERP production fix batch since v1.8.36: #138 write locks for SQL DML,
#139 blank ADT date crash, #141 free-tables handle type, #144 ADI tagdir
page>255, #136 ORDER BY static cursor, plus #140/#134/#137/#135/#143/#142.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants