Conversation
SQLIndex.compact moved then deleted versions that advance onto themselves, so reconstructed values disappeared after compaction under an incomparable frontier.
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.
Summary
SQLIndex.compactskips identity advances when grouping rows to move, so values are kept when a version advances to itself under an incomparable frontier (issue #57). The existingcompactKey/deleteOldVersionsDatastatements never insert-then-delete the same primary key.SQLIndex.compactgrouped that identity version with the versions that move onto it, inserted the summed row, then deleted every source version, including the destination. In-memoryIndex.compactalready deleted before rewriting.Adds the reporter's case to the shared in-memory/SQLite version-index tests.
Provenance: Kevin's reproduction on #57 (in-memory
[[10, 3]], SQLite[]), matching compaction as meet-of-joins.Grouping skips identity advances instead of rewriting compact as materialize → delete sources → insert (match in-memory order). Smallest reversible change; same compacted collection as in-memory. Can switch to the rewrite if the SQL path should share control flow with
Index.compact.Fixes #57
Test plan
packages/d2tstests/version-index.test.ts: in-memory and sqlite, including "compaction with incomparable versions"result1 === []) with the source change reverted, and passes with it restored