Relay: remember a Subgroup's lowest forwarded Object across contributors (FIRST_OBJECT) - #108
Merged
Merged
Conversation
…ributors #103 honours a contributor's FIRST_OBJECT claim (§11.4.2) only if no lower Object ID was forwarded in the Subgroup (§2.2), but kept that in the Subgroup's writer set, which is torn down when its last contributor leaves: a later contributor claiming FIRST_OBJECT above an Object already forwarded was then honoured. The dedup ledger now records the lowest Object ID forwarded per Subgroup (status Objects included, datagrams not), and a new writer set starts from it (TrackEntry.LowestForwarded), within the ledger's 32-Group window. It reads the ledger before taking sg.Mu and keeps the minimum, since a contributor that joined meanwhile may already have forwarded a lower Object; that race is not reproducible in a test and was found in review. TestFanout_MultiPublisher_FirstObjectAfterTeardown and TestTrackEntry_LowestForwarded were verified red first. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
#103 made the relay honour a publisher's FIRST_OBJECT claim (§11.4.2) only if no lower Object ID was already forwarded in the Subgroup. Objects are published in ascending order (§2.2), so a lower ID proves the claim wrong. That record lived in the Subgroup's writer set, which is torn down when the Subgroup's last publisher leaves. A publisher arriving later could then claim FIRST_OBJECT above an Object already forwarded, and the relay passed the claim on. #103 listed this as a known gap.
Change
registry.TrackEntry) records the lowest Object ID forwarded in each Subgroup. Status Objects count; datagrams don't, since FIRST_OBJECT exists only on subgroup streams.TrackEntry.LowestForwardedexposes the value.Tests (verified red first)
TestFanout_MultiPublisher_FirstObjectAfterTeardown:TestTrackEntry_LowestForwarded: the lowest Object per Subgroup, with status Objects counted and datagrams excluded.-raceandmake bench-quickall pass, with no allocs/op increase.Note
A duplicate whose first copy was in another Subgroup, or was a datagram, also lowers the recorded minimum. That can only clear FIRST_OBJECT, never set it wrongly. It's documented on the field.
🤖 Generated with Claude Code