Repository navigation
Conversation
Callback and polling listeners learn of a native stream the way they learn of an external one. A stream a workflow owns notifies the linked channel of its name in the write that appends, without waking the owner, which already follows its own streams through its cursor. A standalone stream, and one a standalone activity owns, reach an independent channel through one coalescing task.
Owner
Author
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.
This PR makes a native stream notify the notification channel named by the stream on every change.
What changed?
<name>notifies the channelstream/<name>linked to the owning run, a stream of an activity the workflow scheduled notifiesstream/<activity id>/<name>linked to that run, and a standalone stream<id>notifies the independent channelstream/<id>. A stream a standalone activity owns notifies the independent channelstream/<activity id>/<name>, since a standalone activity has no linked channels.counteris the stream's new change sequence,positionis the head after the change in the form a native cursor names it (<run>:<offset>, the stream id in place of the run for a standalone stream), and the close carriesclosed: truein the metadata. A producer's deduplicated retry is not a change.stream.notifyChannel(default on) turns it off for a namespace, in which case streams create no channel state, andstream.channelRetainedNotifications(default 16) caps the ring of a stream-driven channel.DescribeChanneland the workflow's channel list report stream-driven channels like any other.tests/stream_channel_test.gocovers the four owner kinds and the switch, and unit tests cover the change sequence, the notification shape, the coalescing task and the listeners-only linked notify.Part of AI-198 (epic AI-37).
Why?
Section 8 of the proposal said native streams share the channel's effect, not its mechanism, and left a write to a native stream notifying the channel named by the stream as a follow-up. With it, a callback or a poller follows a native stream exactly as it follows an external one, and a client derives the channel name from the stream's identity without asking the server. The workflow consumers of native streams keep the consumer table and
AdvanceConsumerHead. Nothing changes for them.How did you test it?
go build ./..., golangci-lint and theerrortypevet are clean on the touched packages. Unit tests ran for./chasm/lib/stream/...,./chasm/lib/channel/...,./chasm/lib/workflow/...,./chasm/lib/activity/...and./service/history/workflow/.... The functional tests ran with-tags disable_grpc_modules,test_dep: an append to a workflow-owned stream shows on the linked channel with the head as position and a counter of one, a second append gives two, a callback registered on it is handed the latest and then each change, the owner gets no Workflow Task and a producer's retry notifies nothing. A standalone stream reaches its independent channel in order through the task, a callback that registers after three appends is handed the third once, and the close is the last change marked closed. A workflow activity's stream notifies its channel and the activity's completion closes it with a last change. A standalone activity's stream notifies its independent channel. With the switch off nothing is created. The stream suites, the notification channel and linked channel suites and the inline handoff cases pass.