Repository navigation
Conversation
GetDelta streams a catch-up as MessageBatch responses of at most 100 messages, and every response carries latest_sequence, the head as of stream open. performDeltaSync took .first(), wrote that batch, then set the cursor to the head. Anything past the first 100 messages was never fetched, and no later sync asked for it, because the cursor already said it was there. The stream is now consumed to the end. Messages are written 500 at a time (DELTA_FLUSH_MESSAGES), and each write moves the cursor to the checkpoint_sequence of the last batch it holds. The cursor reaches the head only when the stream completes. A stream that fails, ends early or runs past 60 s keeps what it delivered, and the next sync resumes from that checkpoint. The timeout exists because the coordinator runs the sync inline in its event handling, and an open stream would hold it. On RESET_REQUIRED after some batches, the delivered batches' checkpoint is kept before LoadMessages runs. loadMessages only moves the cursor forward, so this marks rows that are stored and nothing more. DeltaSyncBatchesTest drives the delegate with a multi-batch fake. Its first three cases failed before this change: a 12-batch catch-up wrote 100 of 1,200 messages.
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.
GetDeltais a server stream (messaging_service.proto:rpc GetDelta(GetDeltaRequest) returns (stream GetDeltaResponse)), sending the catch-up asMessageBatches of at most 100 messages. Every response carrieslatest_sequence, the head as of stream open.performDeltaSynctook.first(), wrote that batch, and set the cursor to the head. Anything past the first 100 messages was never fetched, and no later sync asked for it, because the cursor already claimed it.Change
DELTA_FLUSH_MESSAGES). Each write is followed by anapplyCatchUpto thecheckpoint_sequenceof the last batch it holds, so a 1,000-message catch-up costs observers two invalidations rather than ten.sequenceTrackerreachlatest_sequenceonly when the stream completes.RealChatCoordinatorruns the sync inline in its event handling, and a stream left open would hold every later event.RESET_REQUIREDafter some batches, the delivered batches' checkpoint is kept, thenLoadMessagesruns as before.loadMessagesonly moves the cursor forward, so this marks rows that are stored.Tests
DeltaSyncBatchesTestdrivesEventStreamDelegatewith a multi-batch fake: three batches end at the head, a stream that drops after two resumes from batch two's checkpoint, a reset after one keeps it, and twelve batches are written in fewer than twelve transactions with the cursor only moving forward. The first three cases failed oncode/cash; the twelve-batch case wrote 100 of 1,200 messages.Numbers
The chat-load harness doesn't run
performDeltaSync, and before this change the batches after the first were never applied, so there is no before/after to time.