Fence uncertain Matching task writes before advancing readers - #12010
Draft
taylan-oai wants to merge 1 commit into
Draft
taylan-oai wants to merge 1 commit into
taylan-oai wants to merge 1 commit into
Conversation
|
|
Contributor
|
I don't think this is actually a bug: for a failed AddTask call, the semantics are that the task may or may not be dispatched. In any case, the caller should retry (if it wants the task to definitely be dispatched). Duplicate dispatch if the delayed write is actually read later is protected by RecordTaskStarted (and even if that layer wasn't there, tasks are idempotent). If it's skipped over, then the AddTask retry will handle it. |
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
Fence uncertain non-fair Matching task writes before advancing the readable task-ID boundary, so a delayed write cannot land behind the reader and acknowledgment positions.
Problem
CreateTaskscurrently advancesmaxReadLeveleven when persistence returns an error with an unknown commit outcome. An empty read can then advance the acknowledgment position past a task that commits later. A subsequent successful append can expose the same gap, so leaving the boundary unchanged for only the failed call is insufficient.Approach
Keep the uncertain range closed and reject further writes until the writer renews its lease. The successful range-ID update fences the previous write before readers can cross its IDs. Both classic and priority writers perform this recovery immediately, allocate from the new block, and wake their readers. If recovery fails, the queue unloads with the uncertain range still closed.
Preserve the approximate backlog count while those IDs are hidden. Definite persistence rejections keep their existing accounting and ID-consumption behavior. Fair task writers are outside this change.
Validation
TestLesserNumberOfPollersThanTasksNoDBErrors. An overlay using the unchanged production files from the base commit reproduced these failures. The first full run also hit the existing fake-timeTestPerKeyRateLimittiming bound.Risks, rollout, and scope
An uncertain write now incurs a lease renewal using the existing 30-second retry policy and consumes the remainder of its task-ID block. The original append still fails, so caller retries can produce duplicate logical tasks as before.
The Cassandra test gates the old write before it enters the native store. It exercises the real range-ID compare-and-set and task reads on one Cassandra node; it does not inject replica failures or pause an already-accepted Paxos proposal. SQL fencing was checked in the existing transaction and task-queue lock implementation, without a new SQL integration run. No schema change or migration is required.