Repository navigation
refactor(batch)!: remove allow_replacement_accounting - #1035
Merged
QuantumExplorer merged 1 commit intoNov 9, 2026
Merged
Conversation
The option did two things. It refused an AccountAsReplacement answer when off, which the callback's own answer and Merk's version gate already cover. And it raised estimates, which Platform does not need: Drive estimates a document update as the insertion of everything it writes. Removes BatchApplyOptions::allow_replacement_accounting, the apply_batch.replacement_accounting version slot and the estimators' raise. A write whose flags are byte-equal to the stored ones is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Caution Review failedThe pull request is closed.
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. |
Merged
8 of 14 tasks
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
5 of 14 tasks
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.
Basic explanation
What this does: Removes the
allow_replacement_accountingbatch option added in #1033. A flags update can still answerAccountAsReplacement, and GroveDB accepts that fromGROVE_V5as before. A caller no longer has to set a second switch to allow it.Value: One less thing to keep in step. The option was a second opt-in for something the callback already opts into, and its only other job was raising estimates that Platform does not need. About 2,200 lines go, nearly all of them tests of that raise.
Risks: Low.
GROVE_V5is not released, and every cost, estimate, stored element and hash is what it was for a batch that did not set the option. A caller that estimates real replace operations and also answersAccountAsReplacementwould now get too low an estimate. Platform does not estimate that way: Drive estimates a document update as the insertion of everything it writes, so turning the option on made no difference to its estimates.Issue being fixed or feature implemented
Follow-up to #1033. While adopting it in Platform, the option turned out to change nothing Drive's estimates needed, and to duplicate checks that already exist.
What was done?
AccountAsReplacementonGROVE_V5GROVE_V5Public interface
BatchApplyOptions::allow_replacement_accounting. Code that names it must delete that line.GroveDBApplyBatchVersions::replacement_accounting.AccountAsReplacementbelowGROVE_V5now fails with Merk's refusal (a client corruption error naming just-in-time value update version 2) instead ofError::InvalidBatchOperation. It is refused either way.ElementFlagsUpdate, the flags helpers and the callback signatures.In-place changes to shipped generations
The estimators are back to their code from before #1033, which is what they computed with the option off. The
replacement_accountingslot was 0 onGROVE_V1..GROVE_V4and nothing else read it. The byte-equal check only acts on anAccountAsReplacementanswer, which those versions refuse anyway, so no shipped generation changes behaviour.How Has This Been Tested?
cargo test -p grovedb-version(60),cargo test -p grovedb-epoch-based-storage-flags --lib(67) andcargo test -p grovedb-merk --lib just_in_time(5).cargo test -p grovedb --lib --features full,estimated_costsfiltered tobatch::andbackward_references(320), andcargo test -p grovedb --test written_owner_flags_update(4).cargo clippywith-D warningsongrovedb,grovedb-versionandgrovedb-merk;cargo checkof the minimal-only and verify-only builds;cargo fmt --all --check.Checklist:
🤖 Generated with Claude Code
PR Hygiene ·
3efa3ef/skip-botsproceeds without the ones not yet reported/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.