Close cutover iterators before setter delivery - #56
Merged
Merged
Conversation
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.
The lifecycle worker currently invokes cutover setters while its global read iterator remains open. A setter sharing a bounded connection pool with the reader can therefore wait forever for a resource held by that iterator.
This change folds and buffers accepted cutovers during the read, closes the iterator, and only then delivers them in order. A close failure suppresses all buffered delivery and is joined with any read or validation failure. An accepted prefix is still delivered before a later non-cancellation failure, while a delivery failure keeps precedence over failures observed later in logical stream order.
Cancellation before post-close delivery suppresses the buffered cutovers without discarding an independent read or validation failure. The public worker contract now states that setters may share a bounded resource with the reader. Regression coverage includes multiple cutovers from one read, validation plus close failures, cancellation/error composition, and an end-to-end one-slot shared-resource test.
Verification:
go test -count=1 -race ./...go vet ./...go build ./...golangci-lint runCloses #55