Conversation
mxsrc
force-pushed
the
sse
branch
3 times, most recently
from
July 7, 2026 23:13
9ace6b8 to
f96a723
Compare
mxsrc
force-pushed
the
sse
branch
2 times, most recently
from
July 17, 2026 14:49
f76284b to
9739d2e
Compare
mxsrc
force-pushed
the
sse
branch
2 times, most recently
from
August 26, 2026 08:55
195997f to
4af73b3
Compare
Detail/list endpoints gain a parameter to toggle streaming. With this set, SSE is used to return the initial representation once and watch the database for future changes.
_NoTxnStore.add() and the two hand-rolled transaction fakes didn't exist when these tests were written; watched-model writes now issue an atomic add() for the watch-index counters, which the fakes must accept.
The control plane patched StorageNodeSet.status.nodes[] from six event handlers whenever a node's status, health, or ports changed, a device came or went, a volume was created or deleted, or a node was removed. The operator writes every one of those fields into the same array itself, from the same backend node list, so this was a second writer of state it does not own. patch_cr_node_status said as much in its own docstring: status.nodes is "replaced wholesale by several concurrent writers", "a read can transiently miss a node that a concurrent writer is about to (re)add", and "a blind write can silently drop a concurrent update". Five retries with optimistic locking existed to survive a race that only existed because of this. Removing the writer removes the race rather than retrying it. The operator no longer needs the mirror either. It streams storage nodes over the control plane's own watch endpoint and writes the CRs from that, so a status change reaches Kubernetes in about a second without anything here reaching into the cluster. The removal takes the per-event work with it. Each handler looked the cluster up by id purely to test cluster.mode == "kubernetes", so five of those lookups, and the device counting that fed the devices field, were work done on every event to compute something nobody reads now. Node removal goes too. Nothing here prunes an entry any more, and the operator's own rebuild of status.nodes from the streamed node list is what takes over -- a node the control plane no longer reports is absent from the list rather than needing a deletion to be sent. patch_cr_status (cluster and pool) and patch_cr_lvol_status are untouched. Co-Authored-By: Claude Opus 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.
Detail/list endpoints gain a parameter to toggle streaming. With this set, SSE is used to return the initial representation once and watch the database for future changes. The query parameter
watchcan be used to indicate this behavior. Watches are centrally managed, with database responses being cached. Upon a change in the database, the modified entity is returned, along with an indication of the event-type (creation, update, deletion).An example of how this will look in practice: