Skip to content

feat: count a Stream's Retention from its close - #229

Merged
moetemp merged 2 commits into
moe/brook/streams-combinedfrom
moe/streams-retention-from-close
Nov 10, 2026
Merged

moetemp merged 2 commits into
moe/brook/streams-combinedfrom
moe/streams-retention-from-close

Conversation

@moetemp

@moetemp moetemp commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

This PR counts a Stream's Retention from its close, as a namespace's Retention does.

A Stream that stayed open longer than its Retention lost its first Records. Each append trimmed the
Records older than the Retention, a read hid them, and the log expired one Retention after the last
write. The memory Store now keeps every Record of an open Stream until the Stream expires, which is
the safety TTL after its last write. A closed Stream still expires one Retention after the close.

  • StreamState::retained_from hides no Record by its age. trimmed stays for a write that finds
    the log gone, as after an eviction.
  • The shared suites check that an open Stream past its Retention still gives its first Record, and
    that a closed one expires one Retention after the close. The new RawKeys::drop_log lets the
    Store suite reach the gone-log path, so each Store crate implements it.

The Redis Store's change is temporal-community/sdk-streams#8.

An open Stream also keeps each Producer's dedupe and fence state. No append drops it by age, so a
resend of a silent Producer's last batch gets the first answer, and a lower epoch of the Producer
stays fenced. That change is the follow-up commit 6193d2e on
moe/streams-retention-from-close, which also drops the :producers key.

A Stream that stayed open longer than its Retention lost its first Records. The Retention counts from the close, as a namespace's Retention does, and the safety TTL bounds an idle open Stream.
The first wording took a second read.
@moetemp
moetemp merged commit 9763421 into moe/brook/streams-combined Nov 10, 2026
16 of 22 checks passed
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