Skip to content

Check Jetty replay digests and end Workflow reads - #362

Closed
moetemp wants to merge 13 commits into
moe/jetty/v2/j5-direct-readsfrom
moe/jetty/v2/j6-read-takeovers
Closed

moetemp wants to merge 13 commits into
moe/jetty/v2/j5-direct-readsfrom
moe/jetty/v2/j6-read-takeovers

Conversation

@moetemp

@moetemp moetemp commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

This PR checks native replay reads by digest and lets Workflow readers stop for Continue-As-New. It cancels unused wakes and sends replay retention floors to the native Store.

This is a frozen Jetty prototype. See the Brook design and Python implementation for current work.

The November review inspected the source and existing test coverage. It did not rerun the frozen native server stack.

Reviewer's guide

This is a frozen prototype. Review current Streams behavior in the Python implementation.

  1. Read _workflow_reader.py and native.py under temporalio/contrib/streams together. Check digest validation, reader cancellation, and retention floors across Continue-As-New.
  2. Compare the saved cursor with the resumed read. Review pending wake cleanup before assuming old prototype Histories remain replayable.

Workflow reads send floor_from and max_bytes and take continue_as_new_suggested from a page. The proto is a3 780768b5 byte for byte.
An idle native reader read twice per wake, a read from END lost the Record that woke it, and a replay took other Records with the same count. A reader that waits at the end never saw continue-as-new advice, so the read ends and gives next_offset (S112, S113).
Server t10 parks a wake up to stream.maxWakeWait, so an idle reader adds no History each minute. A namespace that caps Nexus operations below it ends the wake as an empty one (S112).
A wake may park for days, so a read that its code closed must not leave it on the server.
The native server closes a Workflow's Stream with the run, also on terminate, so only Redis and memory need the owner-end flag.
s21 lets only a Stream's owner close it, so an Activity can no longer close its Workflow's Stream, and the test shows that refusal (S114).
A Redis page is a History marker, and the server terminates a run whose marker is over 2 MiB. The cap leaves room for the marker's envelope (S112).
…-takeovers

j5 has Brook p34 and crate k2. The read codec and the describe Local Activity use the client's own runtime, and the plugin drops a run's pages when the Worker evicts it.
One iterator shape in every context gives Workflow code next_offset and the offsets a Superseded item withdraws, next to its continue-as-new end (S113, S119).
WorkflowItems is a Subscription, so it keeps next_offset at a Superseded item whose Record shares its offset, as a client read does (S113).
@moetemp moetemp changed the title [Jetty] Ended Workflow reads on their own and checked replays by digest. Check Jetty replay digests and end Workflow reads Nov 27, 2026
@moetemp moetemp closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant