This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 3593f8bccaf Revert "[fix](env) state listener avoid endless waiting 
#27881 (#41462)" (#41669)
3593f8bccaf is described below

commit 3593f8bccafc91f6345d1d3c796d01bb21dffdf7
Author: walter <w41te...@gmail.com>
AuthorDate: Thu Oct 10 22:23:45 2024 +0800

    Revert "[fix](env) state listener avoid endless waiting #27881 (#41462)" 
(#41669)
---
 .../main/java/org/apache/doris/catalog/Env.java    | 27 +++++-----------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index f7148d45390..dd65fa7cafd 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -925,7 +925,8 @@ public class Env {
         createTxnCleaner();
 
         // 6. start state listener thread
-        startStateListener();
+        createStateListener();
+        listener.start();
 
         if (!Config.edit_log_type.equalsIgnoreCase("bdb")) {
             // If not using bdb, we need to notify the FE type transfer 
manually.
@@ -1478,22 +1479,11 @@ public class Env {
      * 2. register some hook.
      * If there is, add them here.
      */
-    public boolean postProcessAfterMetadataReplayed(boolean waitCatalogReady) {
+    public void postProcessAfterMetadataReplayed(boolean waitCatalogReady) {
         if (waitCatalogReady) {
             while (!isReady()) {
-                // Avoid endless waiting if the state has changed.
-                //
-                // Consider the following situation:
-                // 1. The follower replay journals and is not set to ready 
because the synchronization internval
-                //    exceeds meta delay toleration seconds.
-                // 2. The underlying BEBJE node of this follower is selected 
as the master, but the state listener
-                //    thread is waiting for catalog ready.
-                if (typeTransferQueue.peek() != null) {
-                    return false;
-                }
-
                 try {
-                    Thread.sleep(100);
+                    Thread.sleep(10 * 1000);
                 } catch (InterruptedException e) {
                     LOG.warn("", e);
                 }
@@ -1502,7 +1492,6 @@ public class Env {
 
         auth.rectifyPrivs();
         catalogMgr.registerCatalogRefreshListener(this);
-        return true;
     }
 
     // start all daemon threads only running on Master
@@ -1620,10 +1609,7 @@ public class Env {
             }
 
             // 'isReady' will be set to true in 'setCanRead()' method
-            if (!postProcessAfterMetadataReplayed(true)) {
-                // the state has changed, exit early.
-                return;
-            }
+            postProcessAfterMetadataReplayed(true);
 
             checkLowerCaseTableNames();
 
@@ -2480,7 +2466,7 @@ public class Env {
         }
     }
 
-    public void startStateListener() {
+    public void createStateListener() {
         listener = new Daemon("stateListener", STATE_CHANGE_CHECK_INTERVAL_MS) 
{
             @Override
             protected synchronized void runOneCycle() {
@@ -2588,7 +2574,6 @@ public class Env {
         };
 
         listener.setMetaContext(metaContext);
-        listener.start();
     }
 
     public synchronized boolean replayJournal(long toJournalId) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to