dengziming commented on code in PR #13432:
URL: https://github.com/apache/kafka/pull/13432#discussion_r1167773347


##########
clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminApiDriver.java:
##########
@@ -260,12 +261,29 @@ public void onFailure(
                 .filter(future.lookupKeys()::contains)
                 .collect(Collectors.toSet());
             retryLookup(keysToUnmap);
+        } else if (t instanceof UnsupportedVersionException) {

Review Comment:
   We should add 2 test cases in AdminApiDriverTest to test this:
   1. testFulfillmentUnsupportedVersion
   2. testFulfillmentRetribleUnsupportedVersion
   
   The first is to verify unsupportedVersionException will return in failed, 
the code like this:
   ```
   ctx.poll(emptyMap(), map(mkSet("foo"), failed("foo", new 
UnsupportedVersionException("unsupported api"))));
   ctx.poll(emptyMap(), emptyMap());
   ```
   The second is more complex, you should implement `handleUnsupportedVersion` 
in `MockAdminApiHandler` to support retry on unsupported, the code may like 
this:
   ```
       ctx.handler.addRetriableUnsupportedVersionKey("foo");
       ctx.handler.expectRequest(mkSet("foo"), failed("foo", new 
UnsupportedVersionException("unsupported api")));
       ctx.handler.expectRequest(mkSet("bar"), failed("foo", new 
UnsupportedVersionException("unsupported api")));
       
       // verify retry on foo and not retry on bar.
       List<RequestSpec<String>> requestSpecs = ctx.driver.poll();
   
       requestSpecs.forEach(requestSpec -> {
           ctx.driver.onFailure(ctx.time.milliseconds(), requestSpec, new 
UnsupportedVersionException("unsupported api"));
       });
       ctx.poll(emptyMap(), map(
           mkSet("foo"), failed("foo", new 
UnsupportedVersionException("unsupported api"))
       ));
   ```



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