perf(pack): single-shot trailing truncate + sequential bulk scan - #164
Merged
FiveTechSoft merged 1 commit intoAug 5, 2026
Merged
Conversation
Reapplies the Russoft PACK optimization on top of v1.8.31. - IDriver::truncate_to(recno): drop every record above recno in one header/EOF rewrite plus a physical file truncate. Implemented for CDX and ADT; default returns false so other drivers keep the legacy path. - Table::pack(): copy-down now reads through the driver (read-ahead friendly) instead of goto_record(), which reseeked the active order on every record; the tail is dropped via truncate_to, falling back to the old read-all + zap + re-append pass when the driver declines. CDX truncate_to also shrinks the file: without it the .dbf keeps stale trailing records and a later physical-order walk that derives the count from file size runs past rec_count_ -> ADSCDX/5000. Suite: 1177/1189 passed, same 12 SQL-parser (7200) failures as pristine v1.8.31 — no regressions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit adb0792)
FiveTechSoft
added a commit
to russimicro/OpenADS
that referenced
this pull request
Aug 5, 2026
…chSoft#164 Keep both the OPENADS_ADI_V2 gate (adi_v2_enabled) and the live-key count memoisation from FiveTechSoft#160. Register the new keycount cache test alongside the ADI v2 regression suite.
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.
PACKcopied the survivors down and then dropped the tail by re-reading thetable through the navigation path and re-appending, which is far more I/O than
the operation needs on a table with many deleted rows.
The patch scans sequentially through the bulk-read path and truncates once,
at the end.
It adds one method to
driver_trait.h:The default returns
false, so a driver that does not implement it keeps thelegacy save/zap/re-append path unchanged. This PR implements it for the CDX and
ADT drivers, where the trailing region is exactly
hdr_len + rec_count * rec_len(ADT keeps no 0x1A marker, DBF's is rewritten).Tests
Full suite green on this branch (1290 cases), including the existing PACK/ZAP
and record-count tests.