feat(inkless:switch): gate consolidation on the switch phase #840
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #840"
general
weight: 0.35
giuseppelillo
A committed seal doesn't mean the classic prefix is safe to drop from local disks. Until the controller commits
classicPrefixInRemoteStorage, the local logs of the ISR members store the only complete copy. In phase 1, a replica that starts consolidating advances the cross-tier log start offset over a prefix that remote storage doesn't hold yet. A client routed to a replica outside the ISR can read a truncated prefix.In phase 2 the opposite holds. In the record that sets the flag, the controller adds every live replica to the ISR without checking its local copy. From then on, brokers trust only the remote copy.
Phase 1: treat the partition as not consolidating
consolidationActiveFor(tp)gates consolidation per partition and is off in phase 1.isReadyForConsolidationandConsolidationReconcilerwait for the flag.InklessMetadataViewexposes the flag,isSwitchedPhaseOne, andisSwitchedWithLocalClassicPrefix.Phase 2: delete the local classic prefix
UnifiedLog.forceDeleteLocalSegmentsBelow. If the active segment contains the end of the prefix, the replica rolls it first. The deletion skips the retention checks. It advances the local log start offset and keeps the log start offset and the leader epoch cache. Reads below the seal take the tiered path, and the leader can still validate follower fetches.ReplicaManagerretries the rest once per second.readFromLognever serves local records below the seal. If this broker's highest offset in remote storage covers the offset, a consumer read takes the tiered path. Otherwise, and for followers, the broker answersNOT_LEADER_OR_FOLLOWER, and the client retries. The check runs on the records that the read returned, so one rule covers both fetch branches, a fetch that waited in purgatory since phase 1, a read that races the deletion, and a log directory move that swaps the log. A read that hits the local prefix also queues the deletion again.shouldDelayFutureReplicaPromotionruns forced deletion on the caught-up future log and delays promotion while that log still holds prefix records.applyDeltawaits for idle fetcher threads to stop while it holdsreplicaStateChangeLock, so taking that lock from the fetcher thread could deadlock.UnifiedLog.javaandReplicaAlterLogDirsThread.scalabecome interleaved paths inINKLESS_OWNERSHIP.Known limitations
remote.log.copy.disableistrue, the broker keeps the prefix and logs a warning. Consumer reads succeed only for offsets that this broker already sees in remote storage.DisklessFetchOffsetRouterand the pending-state handling as they are. ISR shrink (KC-633),DeleteRecords, andRetentionEnforcerare out of scope.Testing
ReplicaManagerInklessTestcovers per-partition gating, the fence of a phase 1 leader below the seal, the phase 1 to phase 2 hand-off for leaders and followers, deletion on the flag commit and its retry, the read check in both phases with and without purgatory, the tiered path for a consumer read of a local prefix that remote storage covers, a phase 2 read below the seal that returns nothing, a storage error during the deletion, the promotion decision, and a log directory move that spans the flag commit.ReplicaFetcherThreadTestchecks that a consolidating follower at the seal waits for the ISR in phase 1, and that eviction deletes the prefix before consolidation starts.ConsolidationReconcilerTestcovers the phase 1 retry.UnifiedLogTestchecks that forced deletion keeps the log start offset and the epoch cache. Other cases cover the active-segment roll, the remote-copy precondition, and segments that remote storage doesn't cover.ReplicaAlterLogDirsThreadTestchecks that a delayed promotion keeps the partition on the thread, and that the thread rolls the future log at the seal before it appends.InklessMetadataViewTestandInklessTopicMetadataTransformerTestcover the phase predicates and ISR-only routing.InklessTopicTypeSwitcherClusterTestruns on the tiered storage stack and waits until every broker deletes its local prefix before it consumes. The consumer then reads the switched prefix from remote storage. With the no-op remote storage manager, the switch test fails.ReplicaManagerTest,DelayedFetchTest,DisklessSwitchFlowTest,InitDisklessLogManagerTest, andDisklessFetchOffsetRouterTestpass unchanged.make valedoesn't report any alerts.