Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perf(storage): rewrite hot cache and volume WAL overlay - #1562

Merged
joshuajbouw merged 3 commits into
mainfrom
codex/hot-kv-read-cache
Aug 20, 2026
Merged

joshuajbouw merged 3 commits into
mainfrom
codex/hot-kv-read-cache

Conversation

@joshuajbouw

@joshuajbouw joshuajbouw commented Aug 17, 2026

Copy link
Copy Markdown
Member

Linked Issue

Closes #1561

Summary

Rewrite of the owner-scoped KV hot cache and single-sync transaction WAL onto post-#1535 AstridVolume. The previous codex/hot-kv-read-cache commits conflicted with the owned-filesystem cut; this head is a new implementation on current main (3f82d81e) that keeps the issue's semantics: bounded conditional batches, governed hot reads, one WAL sync per accepted group, and committed state served from a pending overlay before canonical arena/root fold.

WAL bytes live in the transactions.wal volume region rather than a host PathBuf. New WAL publication is opt-in (TransactionWalPolicy; default remains the legacy arena-then-root path). Recovery still replays an existing WAL even when new writes are disabled. The existing KV batch API is reused rather than duplicated.

This replaces the conflicting pre-#1535 draft on this PR number. Head SHA: a4e52546.

Changes

  • Owner-scoped point-read cache (KvReadCacheConfig / KvReadCacheCapacity), disabled unless an embedding opts in and reserves charge
  • Streaming ASTWAL2 grammar, writer, scan, replay, and pending overlay under engine/durable/wal/
  • WAL publication through DurableEnginePolicy::with_transaction_wal; WAL file is a volume region (transactions.wal)
  • Recovery, snapshots, usage, staging, compaction, and close observe or drain pending WAL state
  • Canonical object/root formats, quota accounting, one-owner rejection, and unsupported-backend fallback unchanged
  • Changelog entry under [Unreleased]

Verification

  • cargo test -p astrid-storage --lib --locked — 746 passed (storage library suite on this head)
  • cargo fmt --all -- --check
  • git diff --check

Not re-run on this rewrite: the original SurrealKV exact-durability comparison (~0.509x to ~0.947x of SurrealKV on the development machine). That measurement belonged to the pre-#1535 branch. This PR preserves the cache/batch/WAL semantics and ships the volume-backed rewrite; it does not claim a fresh SurrealKV number until that bench is re-run against AstridVolume.

Test Plan

  • cargo test -p astrid-storage --lib --locked
  • cargo clippy -p astrid-storage --all-targets --all-features --locked -- -D warnings
  • Focused WAL / overlay / crash-replay / hot-cache / batch tests under crates/astrid-storage
  • CI: Test (macos/ubuntu), Clippy, MSRV 1.95.0, Wasm portability, Public API diff

AI / Tool Assistance

Assisted-by: OpenAI Codex: Grok 4.6

Codex reimplemented the cache and WAL overlay against AstridVolume in an isolated worktree (/tmp/astrid-1562-volume-wal-cache), including tests and the changelog entry. Human owns review, merge, and any re-benchmark against SurrealKV.

How it was reviewed:

Checklist

  • Linked to an issue
  • CHANGELOG.md updated (entry under [Unreleased])
  • I understand every change in this PR and can explain its design, risks, and validation.
  • I reviewed and tested any meaningful tool-generated output included in this PR.
  • Every non-bot, non-merge commit has a matching Signed-off-by trailer.

Copilot AI balanced review requested due to automatic review settings August 17, 2026 11:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

joshuajbouw added a commit that referenced this pull request Aug 18, 2026
Bind the graphical Home and personal renderer model to the existing resource, storage, and execution-provider architecture. Treat semantic scenes as untrusted projections, Spaces as composition rather than authority, and refresh the storage integration order around PRs #1535 and #1562.\n\nRefs #1564\n\nSigned-off-by: Joshua J. Bouw <[email protected]>
joshuajbouw added a commit that referenced this pull request Aug 18, 2026
Bind the graphical Home and personal renderer model to the existing resource, storage, and execution-provider architecture. Treat semantic scenes as untrusted projections, Spaces as composition rather than authority, and refresh the storage integration order around PRs #1535 and #1562.

Refs #1564

Signed-off-by: Joshua J. Bouw <[email protected]>
Reimplement owner-scoped KV hot reads and a single-sync transaction WAL
against the post-#1535 AstridVolume durable engine. Committed WAL state
is served from a pending overlay before canonical arena/root fold, WAL
bytes live in the transactions.wal volume region, and the existing KV
batch API is reused rather than duplicated.

Closes #1561

Assisted-by: OpenAI Codex: Grok 4.6

Signed-off-by: Joshua J. Bouw <[email protected]>
@joshuajbouw
joshuajbouw force-pushed the codex/hot-kv-read-cache branch from 9ff1178 to a4e5254 Compare August 20, 2026 00:42
@joshuajbouw joshuajbouw changed the title perf(storage): add atomic batches and single-sync WAL publication perf(storage): rewrite hot cache and volume WAL overlay Aug 20, 2026
@joshuajbouw
joshuajbouw marked this pull request as ready for review August 20, 2026 00:43
Keep WAL/cache semantics. Default KvReadCacheConfig retains nothing
until a reserved or governed budget is supplied. Split oversized
durable/mod.rs and group.rs into named modules without comment-stripping
or include! shards. Disclose ReadyKvRoot, current_kv_root_if_ready, and
FaultPoint::AfterWalPublication. Add volume-backed WAL crash/reopen,
torn-tail, and disabled-policy replay regressions.

Assisted-by: OpenAI Codex: Grok 4.6

Signed-off-by: Joshua J. Bouw <[email protected]>
Construct the opt-in 64 MiB budget from const NonZeroUsize values so
clippy -D warnings no longer requires missing_panics_doc, and backtick
MiB in the rustdoc to satisfy doc_markdown.

Assisted-by: OpenAI Codex: Grok 4.6

Signed-off-by: Joshua J. Bouw <[email protected]>
@joshuajbouw
joshuajbouw merged commit 0aca3f4 into main Aug 20, 2026
33 checks passed
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.

storage: add atomic KV batches and single-sync WAL publication

2 participants