kamalcph commented on code in PR #14127: URL: https://github.com/apache/kafka/pull/14127#discussion_r1300348538
########## 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: Currently, the LIST_OFFSETS call is sync which is handled by the request handler threads so the request-handler-thread will be blocked here. Until KAFKA-13560 gets implemented, it's good to reduce the timeout to 1s (or) throw error immediately as suggested. Also, it will unblock the remote-log-reader threads where it can be utilised for other initialized partitions. -- 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