You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "satishd (via GitHub)" <gi...@apache.org> on 2023/05/13 16:10:29 UTC

[GitHub] [kafka] satishd commented on a diff in pull request #13689: KAFKA-14975: Wait for TopicBasedRemoteLogMetadataManager.ensureInitializedAndNotClosed to initialize rather than throwing

satishd commented on code in PR #13689:
URL: https://github.com/apache/kafka/pull/13689#discussion_r1193008914


##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java:
##########
@@ -489,14 +498,28 @@ public boolean isInitialized() {
         return initialized.get();
     }
 
-    private void ensureInitializedAndNotClosed() {
+    private void ensureInitializedAndNotClosed() throws RemoteStorageException {
         if (initializationFailed) {
             // If initialization is failed, shutdown the broker.
             throw new FatalExitError();
         }
-        if (closing.get() || !initialized.get()) {
-            throw new IllegalStateException("This instance is in invalid state, initialized: " + initialized +
-                                                    " close: " + closing);
+
+        if (!initialized.get()) {
+            log.info("Waiting for TopicBasedRemoteLogMetadataManager to initialize");
+            try {
+                if (!initializeLatch.await(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {

Review Comment:
   Right, that was the reason for failing the requests immediately. We do not want to hold on to those threads until the RLMM initialises. 



-- 
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-unsubscribe@kafka.apache.org

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