kamalcph commented on code in PR #14127:
URL: https://github.com/apache/kafka/pull/14127#discussion_r1285671465


##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/RemoteLogMetadataCache.java:
##########
@@ -104,6 +106,22 @@ public class RemoteLogMetadataCache {
     // https://issues.apache.org/jira/browse/KAFKA-12641
     protected final ConcurrentMap<Integer, RemoteLogLeaderEpochState> 
leaderEpochEntries = new ConcurrentHashMap<>();
 
+    private final CountDownLatch initializedLatch = new CountDownLatch(1);
+
+    public void markInitialized() {
+        initializedLatch.countDown();
+    }
+
+    public void ensureInitialized() throws InterruptedException {
+        if (!initializedLatch.await(2, TimeUnit.MINUTES)) {

Review Comment:
   Both `FETCH` and `LIST_OFFSETS` APIs will hit this method. If the partition 
is not initialised within the timeout (2 mins / 10 secs), then we throw 
`RemoteResourceNotFoundException` which will in turn throw 
`UNKNOWN_SERVER_ERROR` back to the caller. 
   
   Consumer will retry the `FETCH` request as `UNKNOWN_SERVER_ERROR` is 
retriable. The `LIST_OFFSETS` call can originate from both Consumer and Admin 
client. Consumer retries the request on receiving retriable error but `Admin` 
client won't. If the user tries to increase the request timeout from 30 secs to 
2 min in AdminClient, then the `LIST_OFFSETS` request should succeed.
   
   This timeout specified here is kind of upper boundary where we expect the 
RLMM to initialise the partition within that amount of time. 
   
   If the request timeout is configured to default value of 30 secs on the 
client, then the request gets timed out and the client retries the request. In 
case of `AdminClient`, the user gets to know that the request was failed due to 
TimeoutException and will increase the request timeout as appropriate.



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