Skip to content

Fix sled backend del() and add time travel support#310

Open
lawless-m wants to merge 1 commit intocozodb:mainfrom
lawless-m:pr/sled-fix
Open

Fix sled backend del() and add time travel support#310
lawless-m wants to merge 1 commit intocozodb:mainfrom
lawless-m:pr/sled-fix

Conversation

@lawless-m
Copy link
Copy Markdown

Summary

Two independent fixes to the sled backend, bundled because they touch the same file:

  1. del() bug: writes PUT_MARKER instead of DEL_MARKER into the per-transaction changes buffer, so deletes within a transaction were silently treated as empty puts. Flip the marker.
  2. Time travel: range_skip_scan_tuple() returned an error iterator, disabling time travel on sled entirely. Implemented using the same check_key_for_validity seek pattern as the memory backend, with SledSkipIterator (read path) and SledSkipDualIterator (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 — clean
  • Time travel tests on the sled backend (pre-PR: erroring; post-PR: expected to pass)
  • Confirm del() within a txn actually deletes (existing tests should cover this once they run)

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>
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.

1 participant