kevin-wu24 commented on code in PR #22620:
URL: https://github.com/apache/kafka/pull/22620#discussion_r3468326657
##########
raft/src/main/java/org/apache/kafka/raft/internals/UpdateVoterHandler.java:
##########
@@ -101,50 +116,20 @@ public CompletionStage<UpdateRaftVoterResponseData>
handleUpdateVoterRequest(
);
}
- // Read the voter set from the log or leader state
- KRaftVersion kraftVersion = partitionState.lastKraftVersion();
- final Optional<KRaftVersionUpgrade.Voters> inMemoryVoters;
- final Optional<VoterSet> voters;
- if (kraftVersion.isReconfigSupported()) {
- inMemoryVoters = Optional.empty();
-
- // Check that there are no uncommitted VotersRecord
- Optional<LogHistory.Entry<VoterSet>> votersEntry =
partitionState.lastVoterSetEntry();
- if (votersEntry.isEmpty() || votersEntry.get().offset() >=
highWatermark.get()) {
- voters = Optional.empty();
- } else {
- voters = votersEntry.map(LogHistory.Entry::value);
- }
- } else {
- inMemoryVoters = leaderState.volatileVoters();
- if (inMemoryVoters.isEmpty()) {
- /* This can happen if the remote voter sends an update voter
request before the
- * updated kraft version has been written to the log
- */
- return CompletableFuture.completedFuture(
- RaftUtil.updateVoterResponse(
- Errors.REQUEST_TIMED_OUT,
- requestListenerName,
- leaderState.leaderAndEpoch(),
- leaderState.leaderEndpoints()
- )
- );
- }
- voters = inMemoryVoters.map(KRaftVersionUpgrade.Voters::voters);
- }
- if (voters.isEmpty()) {
- log.info("Unable to read the current voter set with kraft version
{}", kraftVersion);
+ // Check that the supported version range is valid
+ if (!validVersionRange(partitionState.lastKraftVersion(),
supportedKraftVersions)) {
return CompletableFuture.completedFuture(
RaftUtil.updateVoterResponse(
- Errors.REQUEST_TIMED_OUT,
+ Errors.INVALID_REQUEST,
requestListenerName,
leaderState.leaderAndEpoch(),
leaderState.leaderEndpoints()
)
);
}
- // Check that the supported version range is valid
- if (!validVersionRange(kraftVersion, supportedKraftVersions)) {
+
+ // Check that endpoints includes the default listener
+ if (voterEndpoints.address(requestSender.listenerName()).isEmpty()) {
Review Comment:
I still see the check on my local `trunk`, and I don't see the check in
`KafkaRaftClient` removed as part of this PR. Are you waiting to push a commit
with that?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]