fix(inkless:switch): serve pending ListOffsets from the classic log and defer lookups past a stale high watermark [KC-756] [KC-763] #873
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 587 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.382
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #873"
general
weight: 0.35
viktorsomogyi
This PR fixes two cases where
DisklessFetchOffsetRouterasks the control plane for offsets that the control plane can't answer correctly.Pending switch on a consolidating topic
A partition whose switch is pending (
classicToDisklessStartOffset = -2) took the classic-only path only if the topic didn't consolidate. The switch setsremote.storage.enable, and the topic reads as consolidating from that point. The pending partition then took the hybrid path:EARLIEST_TIMESTAMP,LATEST_TIMESTAMP, andMAX_TIMESTAMPwent to the control plane.UNKNOWN_TOPIC_OR_PARTITION.DelayedRemoteListOffsetsmaps that exception to the client response.kafka-topic-switch.sh statecallslistOffsetsfor the earliest and latest offsets of every partition, and failed on a pending partition.A pending partition now takes the classic-only path on every topic. For example, with a classic log that holds offsets 0 to 999,
LATESTreturns 1000 andEARLIESTreturns 0 while the switch is pending.The leader and the in-sync followers answer client requests.
InklessTopicMetadataTransformeradvertises any alive ISR member as the leader while the classic prefix lives only on local disks, which includes the pending state. A leader-only lookup would answerNOT_LEADER_OR_FOLLOWERto a client that the transformer sent to a follower. A replica outside the ISR, and every replica fetcher request, still gets the leader-only lookup. This rule also applies to a pending partition of a topic that doesn't consolidate, which was leader-only before.Stale high watermark on a hybrid partition
For a timestamp lookup, the router searches the local log first and asks the control plane on a miss. A client lookup hides a match at or past the last fetchable offset:
classicFetchOffsetanswersNONEwith offset-1. The router read that answer as a miss.For example, a consolidating replica restarts with high watermark 1100 and log end offset 1300, and the WAL is pruned up to 1200. A consumer asks for a timestamp whose first match is offset 1150. The local search hides the match, the control plane searches from 1200 and returns 1200, and the consumer skips offsets 1150 to 1199 without an error.
The guard from #870 compares the searchable end of the local log with the start of the diskless log. It used the log end offset (1300), which is past the diskless start (1200). For a client request,
classicSearchRangenow ends at the high watermark, or at the last stable offset forread_committed. In the example, 1100 is before 1200, and the lookup getsOFFSET_NOT_AVAILABLE(LEADER_NOT_AVAILABLEbefore version 5) until the high watermark moves past the WAL start. A replica request keeps the log end offset.The same bound covers a switched leader whose high watermark is below the seal: the existing seal check defers the lookup.
Not in this PR
After the controller commits the seal and until the leader initializes the control plane,
ListOffsetsfor the latest offset still fails withUNKNOWN_TOPIC_OR_PARTITION. On a consolidating topic, the earliest offset fails the same way. This PR doesn't fall back to the classic log there.PostgresControlPlanerunsListOffsetson the read connection, and a read replica that lags behind the primary reports a missing entry for a partition that already holds diskless records. A fallback would then return a stale offset instead of an error.No system test runs
kafka-topic-switch.sh stateon a pending partition.Testing
DisklessFetchOffsetRouterTestcovers a pending partition of a consolidating topic for the latest, earliest, max, and specific timestamps. It also covers a client request on an in-sync replica and a replica fetcher request on an in-sync replica.ReplicaManagerInklessTestcovers a pending partition of a consolidating topic on a real local log: the latest and earliest offsets on an in-sync follower, andNOT_LEADER_OR_FOLLOWERoutside the ISR. The control plane gets no call.ReplicaManagerInklessTestcovers a timestamp lookup on a replica with high watermark 700, log end offset 900, and WAL start 800. A client lookup getsOFFSET_NOT_AVAILABLEfor a hidden match and for a miss. A client lookup with high watermark 850 and a replica lookup get the control-plane offset.OFFSET_NOT_AVAILABLEfail.DisklessFetchOffsetRouterTestandReplicaManagerInklessTestpass.🤖 Generated with Claude Code
Assisted-by: Claude Fable 5.2