Repository navigation
Conversation
Owner
Author
|
Review fixes in 4e4ea4e: the memory Store adds the period with |
Owner
Author
|
Closing as stale. This layer is folded into the v5 tip, #41, and the upstream review uses a fresh series instead. Plan: https://www.notion.so/4048fc567738814990b7c796ac28fe3f |
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.
What changed?
This PR adds
auto_closeto a Stream: no append for that long closes it with no result.CreateStreamRequest.auto_close(5) sets it, counted from the create.DescribeStreamResponse.auto_close(4) reports it. The Store keepsac(the period) andla(the time of the create or of the newest append with Records) in the meta hash.Nothing runs when the period passes. A new
auto_closestep inlib.luaruns first in the create, append and close scripts. When the period passed, it writes the close Record (aStreamRecordwith onlykind = CLOSE, no Producer) in the same Lua call. Then the append is refused withstream_closed, the close answersalready, and the create answersclosed. A resend still gets its first answer.The read script stays read only, so it still runs on a replica. A read or a describe that finds the close due runs the new
auto_close.luastep and reads again. A long-polling read caps its wait at the time the close comes due, so it ends with the close Record.The memory Store has the same step. A new capability
auto_closeguards a create that sets the period, from a client and from a Workflow flush, so a Store without it refuses withstream_unsupportedand writes nothing. Redis and memory declare it. A create with another auto close is a conflict (stream_already_exists), as one with another Retention is.The Workflow path passes
auto_closefrom a buffered create. A Workflow append after an auto close is dropped, as for any close by someone else.Why?
Decision S73 (and S37). A Stream that nobody closes must not stay open until its safety TTL. It is separate from Retention and the safety TTL.
How did you test it?
cargo fmt --all -- --check,cargo clippy --workspace --tests -- -D warnings, andSTREAMS_REQUIRE=redis cargo test --workspaceon standalone Redis, a 3-primary Redis cluster and the memory Store.New Store tests check that each append holds the close off, that the append past the period writes the close Record and is refused, that a resend keeps its answer, that a later close and create see the close, the conflict on another period, and that repeated auto close steps write one close Record. New service tests check that a long poll ends with the close Record soon after the period, that a describe and a read apply a due close, and that an append after it fails with
stream_closed. A capability test masksauto_close. A Workflow test creates with an auto close and sees a later flush dropped. A unit test pins the encoded auto close Record against the bytes inlib.lua.