Fix sled backend del() and add time travel support#310
Open
lawless-m wants to merge 1 commit intocozodb:mainfrom
Open
Fix sled backend del() and add time travel support#310lawless-m wants to merge 1 commit intocozodb:mainfrom
lawless-m wants to merge 1 commit intocozodb:mainfrom
Conversation
del() wrote PUT_MARKER instead of DEL_MARKER into the changes buffer, so deletes within a transaction were silently treated as empty puts. range_skip_scan_tuple() returned an error iterator, disabling time travel on the sled backend. Implement it using the same check_key_for_validity/seek pattern as the memory backend, with SledSkipIterator (read path) and SledSkipDualIterator (write path with uncommitted changes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Two independent fixes to the sled backend, bundled because they touch the same file:
del()bug: writesPUT_MARKERinstead ofDEL_MARKERinto the per-transaction changes buffer, so deletes within a transaction were silently treated as empty puts. Flip the marker.range_skip_scan_tuple()returned an error iterator, disabling time travel on sled entirely. Implemented using the samecheck_key_for_validityseek pattern as the memory backend, withSledSkipIterator(read path) andSledSkipDualIterator(write path, handles uncommitted changes).Happy to split into two PRs if reviewers prefer; kept as one because both touch the same file and together they make sled a first-class backend again.
Test plan
cargo check -p cozo --features storage-sled— cleandel()within a txn actually deletes (existing tests should cover this once they run)