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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b5eeae  Fix bug that DeployManager should start working after catalog 
is ready. (#2244)
9b5eeae is described below

commit 9b5eeaec19d0c4dbf8fbb83e31f58a9f187f73e5
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Wed Nov 20 09:49:09 2019 +0800

    Fix bug that DeployManager should start working after catalog is ready. 
(#2244)
    
    Otherwise, it can not get master ip/port from not-ready catalog.
---
 fe/src/main/java/org/apache/doris/deploy/DeployManager.java   | 6 ++++++
 fe/src/main/java/org/apache/doris/qe/Coordinator.java         | 6 +++---
 fe/src/main/java/org/apache/doris/qe/ResultReceiver.java      | 4 ++--
 fe/src/main/java/org/apache/doris/qe/SimpleScheduler.java     | 2 +-
 fe/src/test/java/org/apache/doris/qe/SimpleSchedulerTest.java | 6 +++---
 5 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/fe/src/main/java/org/apache/doris/deploy/DeployManager.java 
b/fe/src/main/java/org/apache/doris/deploy/DeployManager.java
index 1db2a5d..4cf5ec3 100644
--- a/fe/src/main/java/org/apache/doris/deploy/DeployManager.java
+++ b/fe/src/main/java/org/apache/doris/deploy/DeployManager.java
@@ -323,6 +323,12 @@ public class DeployManager extends Daemon {
             return;
         }
 
+        if (!Catalog.getCurrentCatalog().isReady()) {
+            // this deploy manager thread is started before catalog is ready.
+            // so we have to wait the catalog to be ready.
+            return;
+        }
+
         // 0. init
         if (!init()) {
             return;
diff --git a/fe/src/main/java/org/apache/doris/qe/Coordinator.java 
b/fe/src/main/java/org/apache/doris/qe/Coordinator.java
index 9d61032..15bfd95 100644
--- a/fe/src/main/java/org/apache/doris/qe/Coordinator.java
+++ b/fe/src/main/java/org/apache/doris/qe/Coordinator.java
@@ -499,7 +499,7 @@ public class Coordinator {
                         case TIMEOUT:
                             throw new UserException("query timeout. backend 
id: " + pair.first.backend.getId());
                         case THRIFT_RPC_ERROR:
-                            
SimpleScheduler.updateBlacklistBackends(pair.first.backend.getId());
+                            
SimpleScheduler.addToBlacklist(pair.first.backend.getId());
                             throw new 
RpcException(pair.first.backend.getHost(), "rpc failed");
                         default:
                             throw new UserException(errMsg);
@@ -1334,7 +1334,7 @@ public class Coordinator {
                 } catch (RpcException e) {
                     LOG.warn("cancel plan fragment get a exception, 
address={}:{}", brpcAddress.getHostname(),
                             brpcAddress.getPort());
-                    
SimpleScheduler.updateBlacklistBackends(addressToBackendID.get(brpcAddress));
+                    
SimpleScheduler.addToBlacklist(addressToBackendID.get(brpcAddress));
                 }
 
                 this.hasCanceled = true;
@@ -1373,7 +1373,7 @@ public class Coordinator {
             try {
                 return 
BackendServiceProxy.getInstance().execPlanFragmentAsync(brpcAddress, rpcParams);
             } catch (RpcException e) {
-                SimpleScheduler.updateBlacklistBackends(backend.getId());
+                SimpleScheduler.addToBlacklist(backend.getId());
                 throw e;
             }
         }
diff --git a/fe/src/main/java/org/apache/doris/qe/ResultReceiver.java 
b/fe/src/main/java/org/apache/doris/qe/ResultReceiver.java
index c309414..857b76c 100644
--- a/fe/src/main/java/org/apache/doris/qe/ResultReceiver.java
+++ b/fe/src/main/java/org/apache/doris/qe/ResultReceiver.java
@@ -116,7 +116,7 @@ public class ResultReceiver {
         } catch (RpcException e) {
             LOG.warn("fetch result rpc exception, finstId={}", finstId, e);
             status.setRpcStatus(e.getMessage());
-            SimpleScheduler.updateBlacklistBackends(backendId);
+            SimpleScheduler.addToBlacklist(backendId);
         } catch (ExecutionException e) {
             LOG.warn("fetch result execution exception, finstId={}", finstId, 
e);
             if (e.getMessage().contains("time out")) {
@@ -124,7 +124,7 @@ public class ResultReceiver {
                 status.setStatus(new Status(TStatusCode.TIMEOUT, 
e.getMessage()));
             } else {
                 status.setRpcStatus(e.getMessage());
-                SimpleScheduler.updateBlacklistBackends(backendId);
+                SimpleScheduler.addToBlacklist(backendId);
             }
         } catch (TimeoutException e) {
             LOG.warn("fetch result timeout, finstId={}", finstId, e);
diff --git a/fe/src/main/java/org/apache/doris/qe/SimpleScheduler.java 
b/fe/src/main/java/org/apache/doris/qe/SimpleScheduler.java
index 8db4f01..706fe47 100644
--- a/fe/src/main/java/org/apache/doris/qe/SimpleScheduler.java
+++ b/fe/src/main/java/org/apache/doris/qe/SimpleScheduler.java
@@ -130,7 +130,7 @@ public class SimpleScheduler {
         return null;
     }
     
-    public static void updateBlacklistBackends(Long backendID) {
+    public static void addToBlacklist(Long backendID) {
         if (backendID == null) {
             return;
         }
diff --git a/fe/src/test/java/org/apache/doris/qe/SimpleSchedulerTest.java 
b/fe/src/test/java/org/apache/doris/qe/SimpleSchedulerTest.java
index eb4e7af..541f19b 100644
--- a/fe/src/test/java/org/apache/doris/qe/SimpleSchedulerTest.java
+++ b/fe/src/test/java/org/apache/doris/qe/SimpleSchedulerTest.java
@@ -189,12 +189,12 @@ public class SimpleSchedulerTest {
         threeBackends.put((long) 102, backendC);
         ImmutableMap<Long, Backend> immutableThreeBackends = 
ImmutableMap.copyOf(threeBackends);
 
-        SimpleScheduler.updateBlacklistBackends(Long.valueOf(100));
-        SimpleScheduler.updateBlacklistBackends(Long.valueOf(101));
+        SimpleScheduler.addToBlacklist(Long.valueOf(100));
+        SimpleScheduler.addToBlacklist(Long.valueOf(101));
         address = SimpleScheduler.getHost(immutableThreeBackends, ref);
         // only backendc can work
         Assert.assertEquals(address.hostname, "addressC");
-        SimpleScheduler.updateBlacklistBackends(Long.valueOf(102));
+        SimpleScheduler.addToBlacklist(Long.valueOf(102));
         // no backend can work
         address = SimpleScheduler.getHost(immutableThreeBackends, ref);
         Assert.assertNull(address);


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

Reply via email to