kevin-wu24 commented on code in PR #22191:
URL: https://github.com/apache/kafka/pull/22191#discussion_r3336058110


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -2128,6 +2132,19 @@ public CompletableFuture<Void> registerController(
             EnumSet.noneOf(ControllerOperationFlag.class));
     }
 
+    @Override
+    public CompletableFuture<Void> unregisterController(
+        ControllerRequestContext context,
+        int controllerId
+    ) {
+        if (nodeId == controllerId && isActiveController()) {

Review Comment:
   If a non-active controller tries to run a `ControllerWriteEvent`, that will 
error. It already throws a `NotControllerException`, and is not specific to any 
single Controller API. IMO I view this is "request can be well-formed, but the 
destination is wrong."
   
   I think we should check `isActiveController()`, because the case this is 
checking for is different (it also allows us to throw a "better" exception). 
When trying to remove the active controller, I view this as "the request is 
malformed, but the destination is right." It is an analogous case to trying to 
unregister a controller without a registration.
   
   What do you think?



-- 
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]

Reply via email to