showuon commented on code in PR #15732:
URL: https://github.com/apache/kafka/pull/15732#discussion_r1570596642


##########
metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java:
##########
@@ -391,13 +391,16 @@ void enqueueMetadataChangeEvent(
 
     // Events handled by Migration Driver.
     abstract class MigrationEvent implements EventQueue.Event {
+        // Use no-op handler by default because the retryHandler will be 
overridden if needed
+        public void retryHandler() { }
         @SuppressWarnings("ThrowableNotThrown")
         @Override
         public void handleException(Throwable e) {
             if (e instanceof MigrationClientAuthException) {
                 
KRaftMigrationDriver.this.faultHandler.handleFault("Encountered ZooKeeper 
authentication in " + this, e);
             } else if (e instanceof MigrationClientException) {
                 log.info(String.format("Encountered ZooKeeper error during 
event %s. Will retry.", this), e.getCause());
+                retryHandler();

Review Comment:
   @chia7712 , I take your suggestion to add `RecoverMigrationStateFromZKEvent` 
so that we don't need to worry about retry anymore. I was checking if this 
change will cause any side effect, and here is my finding:
   1. `recoverMigrationStateFromZK` is expected to run before the driver starts 
the state machine.
   2. In the `recoverMigrationStateFromZK`, we'll do these things:
     a. create a ZNode for migration and initial migration state
     b. install this class as a metadata publisher
     c. transition to INACTIVE state
   3. If this `recoverMigrationStateFromZK` is keep failing, the log will keep 
outputting errors and keep retrying. Once it succeeds, the metadata publisher 
will be installed and the `onControllerChange` and `onMetadataUpdate` will be 
triggered to start the process. That means, if we change 
`recoverMigrationStateFromZK` into an event, it won't affect anything because 
what we need to do at this state is just waiting for the (a)(b)(c) operation 
completes.
   
   So, I'm +1 with this suggestion. Thank you.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to