Characterize delayed queue inserts below retired boundaries - #12014
Draft
taylan-oai wants to merge 1 commit into
Draft
Characterize delayed queue inserts below retired boundaries#12014taylan-oai wants to merge 1 commit into
taylan-oai wants to merge 1 commit into
Conversation
|
|
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.
Summary
Characterize Cassandra queue inserts that succeed below a retired read boundary, so a publication contract can be agreed before changing the protocol.
Problem
QueueStore and QueueV2 select the next ID from the current physical maximum, then insert with
IF NOT EXISTS. A producer can pause after selecting ID 0. Another producer writes IDs 0 and 1; a reader processes them; cleanup removes ID 0 while retaining ID 1. When the delayed producer resumes, its insert succeeds because ID 0 is absent. Its new payload is behind the acknowledged cursor or QueueV2 minimum readable ID.QueueV2 also has a gap between physical deletion and the metadata update. A delayed insert can succeed during that gap, and a subsequent metadata read still permits its ID. Cleanup then advances the minimum past it. Checking metadata after insertion alone would therefore miss this interleaving.
Approach
Add comments at the allocation/insertion gap and deterministic Cassandra characterization tests for both queues and the QueueV2 metadata-update gap. The tests assert the current adverse outcome and explicitly identify the future desired contract: an acknowledged insert must not newly publish its payload behind a retired boundary.
Two possible next steps need evaluation:
The namespace queue retry wrapper retries
UnavailableandConditionFailedError; the History task queue manager has no corresponding wrapper, and DLQWriter wraps enqueue failures underErrSendTaskToDLQ. A proposed error change needs caller-level validation. Process-local producer locks do not coordinate different processes with cleanup.Validation
go test -p 4 -tags test_dep, 13.177s).git diff --checkpassed.The tests use real Cassandra conditional inserts, reads, deletes and metadata updates, with channel gates immediately before the selected driver query. They do not pause an already submitted Cassandra operation.
Risks, rollout, and scope
This draft changes comments and tests only. The passing tests document a defect; they do not validate either repair option. Evidence is limited to the persistence boundary and does not establish production frequency, end-to-end workflow loss, or a distributed consistency proof. Legacy main queue is covered; legacy DLQ retirement is outside this reproduction.
References