feat(stream): bound the batch member and observation lists - #2546
Merged
Conversation
stream.batch refused an empty ops list and named the writer it would take for a batch that writes nothing, and did not refuse a large one. In atomic mode the whole list runs inside one BEGIN IMMEDIATE, so the statement count inside a single writer hold was whatever the caller sent, ceilinged only by the 8 MiB frame. The verb now admits at most 1000 members and at most 100 observed entries, refusing with invalid_input that names both the cap and the count sent. The check runs at admission, before any member is parsed into an action, any note plan is prepared, or a writer is requested, and it applies to the list in both modes so one input is refused the same way whatever the mode. Six acceptance arms: a list at the cap commits, a list at the cap with the observation list at its own cap commits, one member over refuses naming 1001 and 1000 with the stream head unchanged as the control that the refusal preceded the writer, one observation over refuses on its own number, per-member mode refuses the same list the same way, and a list of individually-invalid members still refuses on the cap, which is what proves the check runs before members are interpreted. Help names both caps. The ignored cap_measure_writer_hold arm measures the hold with the store's own open-transaction registry rather than wall time around the dispatch, so preparation before the writer is not counted as hold. Implements ADR-174 Amendment 7.
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.
Implements ADR-174 Amendment 7 (#2544).
stream.batchrefused an emptyopslist and named the writer it would take for a batch that writes nothing. It did not refuse a large one, and in atomic mode the whole list executes inside oneBEGIN IMMEDIATE, so the statement count inside a single writer hold was whatever the caller sent. The only ceiling was the daemon's 8 MiB frame, a transport limit.What changes
ops, at most 100 entries inobserved. Over either bound the call refuses withinvalid_inputnaming both the cap and the count sent.stream.batch(help=true)names both caps.Measured writer hold
Taken with the store's own open-transaction registry (
tx_registry::oldest) sampled from a second task, so preparation before the writer is not counted as hold. File-backed store, one dedicated run each, pinned toolchain:Two independent runs of each, on separate gate passes, so the numbers are not one sample. Roughly 300 times the hold, from one caller, against a store that admits one writer. The second row is measured with the cap constant raised, which is the only way to observe the behaviour the amendment exists to prevent; the raise is a one-line patch applied and reverted around that run, with the tree proven clean afterwards.
Acceptance, six arms, all green:
Mutations, both predicted before running and both confirmed: with the member cap raised above the count the over-cap arm sends, that arm goes red (
rc=101) and restores green; with the check moved after member preparation, the precedence arm goes red (rc=101) and restores green. Each revert proved by a clean tree.Gate at the branch head
8247c8d57, pinned toolchain:cargo fmt --all -- --checkclean,cargo clippy -p khive-pack-kg --all-targets -- -D warningsclean,cargo test -p khive-pack-kg --no-fail-fast249 + 308 + 8 + 11 + 5 + 3 + 1 passed, one ignored (the measurement arm), zero failed.One note on arm 1: its 1000 members are appends to a single stream, which is what §5 and Amendment 1 admit (appends to one stream take consecutive numbers). The repeated-target rule governs duplicate write
(kind, key)pairs, so it does not fire here, and a red in that arm would be about the cap rather than about member shape.Closes #2543.