Repository navigation
fix(id/world): track retained admin-history bytes incrementally (#4633) - #4747
Merged
Merged
Conversation
record_admin_history re-serialized every retained admin-history event on every accepted event (and after each trim pop). Cache each event's encoded size once in AdminHistoryByteLedger and maintain the running total on push/pop, so recording is amortized O(1) in retained history size. Unserializable events count as usize::MAX, matching the legacy rescan semantics, so they force a trim instead of occupying unaccounted space. Restore keeps its one-shot over-budget scan and rebuilds the ledger. Regression tests cover the unserializable case, count-trim sync, byte-cap trim of a single oversized event, and restore sync.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 43 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 3, 2026
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.
Fixes #4633. Queue task 6562.
What
record_admin_historycalledadmin_history_bytesin its trim-loop condition on every accepted event, re-serializing the entire retained admin history each time — retained-history-sized synchronous work inside the serialized world actor (code introduced by PR #3998, now merged to main).This change caches each retained event's encoded size once and maintains the byte total incrementally:
AdminHistoryByteLedgerinpkgs/id/src/world/core.rs: one cached size entry per retained event, a running serializable total, and a count of unserializable events.record_admin_historytracks the new event's encoded size once, then trims againstledger.effective_bytes()— amortized O(1) in retained-history size per event.usize::MAXbytes, exactly as the previous rescan helper treated it, so it forces the retained history to trim rather than silently occupying unaccounted space.restore_admin_historykeeps its one-shot over-budget checkpoint rejection scan (acceptable per id(world): admin_history_bytes re-serializes the entire retained admin history on every accepted event (PR #3998) — track retained bytes incrementally #4633) and rebuilds the ledger from the restored events.admin_history_completesemantics are unchanged.Tests
cargo test --manifest-path pkgs/id/Cargo.toml worldon the laptop: 479 passed, 0 failed.admin_history_byte_ledger_counts_unserializable_as_max_until_trimmed,admin_history_byte_ledger_stays_in_sync_through_count_trim,admin_history_byte_cap_trims_even_a_single_oversized_event,admin_history_byte_ledger_stays_in_sync_through_restore— all pass.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.