Repository navigation
feat(revisions): retain history with expiring undo records - #24
Merged
Merged
Conversation
Forward page deltas depend on ancestors beyond the retention window. Capture before-images with their parent state in the publish transaction so SlateDB TTL and compaction can reclaim history independently. Keep HEAD and current pages without expiry so inactivity never removes the current database. Retain replaced states for 30 configurable days, preserve expiry ordering when retention is shortened, and bootstrap expired client cursors against the selected target. BREAKING CHANGE: HEAD and stored revisions use a new format. No migration is provided because the application has not been released.
A cursor spanning page growth followed by shrinkage can include removed tail pages in its change set. Reading those pages produces nil values that cannot be serialized by the protobuf pull stream. Bound selected page IDs to the target snapshot size before fetching them. Cover page selectors, empty targets, and historical targets after HEAD has regrown, including the real SlateDB-to-protobuf streaming path.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
+ Coverage 92.96% 93.22% +0.26%
==========================================
Files 48 48
Lines 3296 3321 +25
==========================================
+ Hits 3064 3096 +32
+ Misses 232 225 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Revision history used forward page deltas, so retaining a revision could require ancestors outside the retention window. Store encrypted undo records instead and let SlateDB TTL and compaction reclaim expired history.
HEAD now contains its own page count, and HEAD/current pages explicitly have no expiry. Publication captures before-images, the parent descriptor, current pages, and HEAD in one transaction and awaits durability. A state remains recoverable for the configured period after it is replaced, including after long inactivity.
REVISION_RETENTION_DAYS(default: 30), preserving expiry order when retention is shortened.The persisted HEAD/revision format is intentionally incompatible; no migration is included for this pre-release application.
Validation:
docker compose run --rm --no-deps app bb verify: 225 tests, 1,032 assertions, no failures; lint, source loading, and formatting passed.clojure -M:e2epassed.Synthetic memory-store measurement (128 × 4 KiB pages, 8 changed pages per revision, 110 revisions): p95 publish 107 ms including durability wait; HEAD read 1.6 ms; previous-revision read 1.5 ms; root read through 110 undo records 25 ms. These are local measurements, not production performance guarantees.