feat(inkless:controller): add the SetClassicPrefixInRemoteStorage RPC [KC-582] #827
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 · 608 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.384
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #827"
general
weight: 0.35
viktorsomogyi
Phase 2 of the classic-to-diskless switch starts when the controller sets
classicPrefixInRemoteStorage(tag 103, added in #824) on a partition. This PR adds the controller side: a broker-to-controller RPC that the partition leader sends once it proves that the classic prefix below the committed seal is in remote storage, and the controller commit that sets the flag. Nothing sends the RPC yet; the broker side follows in KC-588.The commit goes through
PartitionChangeBuilder, not through a raw record like the seal. The same record sets the ISR to the active assigned replicas, so it can complete a reassignment and elect a new leader.Commits
chore(inkless): markReplicationControlManagerandPartitionChangeBuilderas interleaved upstream files inINKLESS_OWNERSHIP.feat(inkless:controller): add the switch flag toPartitionChangeBuilder. The setter adds tag 103, forces a leader epoch increase when nothing else changes the leader, and writes tag 102.feat(inkless:controller): add theSetClassicPrefixInRemoteStorageRPC (API key 503, controller listener only,CLUSTER_ACTION), the controller checks, the entry points, and the flag in theDescribeTopicPartitionsresponse and the topic switch tool output.See the commit messages for the reasoning behind each step, including the order of the controller checks.
Operator impact
kafka-topic-switch.sh stateprintsclassicPrefixInRemoteStoragefor each partition. When the seal is committed, it adds the phase:false (phase 1)ortrue (phase 2).DescribeTopicPartitionsresponse carries tag 103 only for partitions where the flag is set.Testing
PartitionChangeBuilderTest: the flag alone increases the leader epoch once and keeps the leader; an election or a reassignment that removes the leader keeps the new leader; tag 102 equals the new leader epoch, also when it replaces an earlier diskless leader epoch, and the seal stays unchanged.ReplicationControlManagerInklessTest(SetClassicPrefixInRemoteStorageTests, 19 cases): success; a retry after the commit with the old leader epoch succeeds without a record; a different seal after the commit, a seal mismatch, a pending seal, and no seal getINVALID_REQUEST; epoch and leader checks; a fenced leader, a leader in controlled shutdown, and a leaderless partition never reach the builder; the commit adds active replicas to the ISR and keeps fenced ones out; a commit that completes a reassignment elects a new leader; one bad partition in a request does not fail the others.QuorumControllerTest.testSetClassicPrefixInRemoteStorageCommitsFlag: the commit and a retry through a realQuorumControllerwrite event.ControllerApisTest: authorization (CLUSTER_ACTION) andNOT_CONTROLLERfor every partition when the controller future fails.DescribeTopicPartitionsRequestHandlerTestandTopicSwitchCommandTest: the flag in the describe response and the phase in the tool output.RequestResponseTest: serialization of the new request and response.Diskless leader epoch
This PR moves the point where the controller sets the diskless leader epoch (tag 102), from the seal commit to the flag commit. The flag commit writes tag 102 equal to the leader epoch that the record produces. No leader used that epoch before the flag, so it is greater than every classic and phase 1 epoch.
The seal commit sets tag 102 to the leader epoch at the seal. That value can be lower than a phase 1 epoch: if the leader changes while the seal is pending, the new leader adds an epoch cache entry at the seal with a higher epoch. The first consolidated batch carries the lower label, so appending it removes that entry from the epoch cache.
The seal commit still writes tag 102, because today consolidation starts after the seal commit, in phase 1, and stamps batches with that value. If the flag commit overwrote it while those batches exist, the diskless leader endpoint would answer their epoch with the seal, and followers would truncate
[seal, LEO). This can't happen yet: nothing sends the RPC until KC-588. KC-589 gates consolidation on the flag and stops the seal commit from writing tag 102, so no batch carries a label from before the flag. KC-588 and KC-589 ship together for this reason.Follow-ups