guozhangwang commented on a change in pull request #10232:
URL: https://github.com/apache/kafka/pull/10232#discussion_r584479103



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
##########
@@ -961,29 +962,34 @@ protected synchronized String memberId() {
         return generation.memberId;
     }
 
-    private synchronized void resetState() {
+    private synchronized void resetState(final String reason) {
+        log.info("Resetting generation due to: {}", reason);
+
         state = MemberState.UNJOINED;
         generation = Generation.NO_GENERATION;
     }
 
-    private synchronized void resetStateAndRejoin() {
-        resetState();
-        rejoinNeeded = true;
+    private synchronized void resetStateAndRejoin(final String reason) {
+        resetState(reason);
+        requestRejoin(reason);
     }
 
     synchronized void resetGenerationOnResponseError(ApiKeys api, Errors 
error) {
-        log.debug("Resetting generation after encountering {} from {} response 
and requesting re-join", error, api);

Review comment:
       Note that I intentionally bumped up the log level from debug to info 
here since I think this is necessarily a message that users should pay 
attention to in production, where they mostly use INFO. Open for counter 
suggestions though.

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
##########
@@ -775,8 +776,6 @@ public void handle(SyncGroupResponse syncResponse,
                     }
                 }
             } else {
-                requestRejoin();

Review comment:
       We can remove this since it is a bit redundant now as we call for each 
case if necessary.

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
##########
@@ -860,7 +861,7 @@ public void onSuccess(ClientResponse resp, 
RequestFuture<Void> future) {
 
         @Override
         public void onFailure(RuntimeException e, RequestFuture<Void> future) {
-            log.debug("FindCoordinator request failed due to {}", e);
+            log.debug("FindCoordinator request failed due to {}", 
e.toString());

Review comment:
       Minor cleanup, we only need to print the error message but not the stack 
trace.




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

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


Reply via email to