You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/04/14 03:44:47 UTC

[incubator-doris] branch master updated: [fix] fix NPE when initialize GlobalState (#8990)

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 91200cc7a6 [fix] fix NPE when initialize GlobalState (#8990)
91200cc7a6 is described below

commit 91200cc7a690f44b575ab32f37d3866177900825
Author: Mingyu Chen <mo...@gmail.com>
AuthorDate: Thu Apr 14 11:44:41 2022 +0800

    [fix] fix NPE when initialize GlobalState (#8990)
    
    Introduced from #8695
    The context object may be null for StreamLoadPlanner
---
 .../java/org/apache/doris/analysis/Analyzer.java   | 26 ++++++++++++++--------
 .../org/apache/doris/master/ReportHandler.java     |  4 ++--
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index e46831100d..693a90d958 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -47,9 +47,9 @@ import org.apache.doris.rewrite.InferFiltersRule;
 import org.apache.doris.rewrite.NormalizeBinaryPredicatesRule;
 import org.apache.doris.rewrite.RewriteAliasFunctionRule;
 import org.apache.doris.rewrite.RewriteBinaryPredicatesRule;
+import org.apache.doris.rewrite.RewriteDateLiteralRule;
 import org.apache.doris.rewrite.RewriteEncryptKeyRule;
 import org.apache.doris.rewrite.RewriteFromUnixTimeRule;
-import org.apache.doris.rewrite.RewriteDateLiteralRule;
 import org.apache.doris.rewrite.mvrewrite.CountDistinctToBitmap;
 import org.apache.doris.rewrite.mvrewrite.CountDistinctToBitmapOrHLLRule;
 import org.apache.doris.rewrite.mvrewrite.CountFieldToSum;
@@ -330,15 +330,23 @@ public class Analyzer {
             mvRewriteRules.add(CountFieldToSum.INSTANCE);
             mvExprRewriter = new ExprRewriter(mvRewriteRules);
 
-            // compute max exec mem could be used for broadcast join
-            long perNodeMemLimit = context.getSessionVariable().getMaxExecMemByte();
-            double autoBroadcastJoinThresholdPercentage = context.getSessionVariable().autoBroadcastJoinThreshold;
-            if (autoBroadcastJoinThresholdPercentage > 1) {
-                autoBroadcastJoinThresholdPercentage = 1.0;
-            } else if (autoBroadcastJoinThresholdPercentage <= 0) {
-                autoBroadcastJoinThresholdPercentage = -1.0;
+            // context maybe null. eg, for StreamLoadPlanner.
+            // and autoBroadcastJoinThreshold is only used for Query's DistributedPlanner.
+            // so it is ok to not set autoBroadcastJoinThreshold if context is null
+            if (context != null) {
+                // compute max exec mem could be used for broadcast join
+                long perNodeMemLimit = context.getSessionVariable().getMaxExecMemByte();
+                double autoBroadcastJoinThresholdPercentage = context.getSessionVariable().autoBroadcastJoinThreshold;
+                if (autoBroadcastJoinThresholdPercentage > 1) {
+                    autoBroadcastJoinThresholdPercentage = 1.0;
+                } else if (autoBroadcastJoinThresholdPercentage <= 0) {
+                    autoBroadcastJoinThresholdPercentage = -1.0;
+                }
+                autoBroadcastJoinThreshold = (long) (perNodeMemLimit * autoBroadcastJoinThresholdPercentage);
+            } else {
+                // autoBroadcastJoinThreshold is a "final" field, must set an initial value for it
+                autoBroadcastJoinThreshold = 0;
             }
-            autoBroadcastJoinThreshold = (long)(perNodeMemLimit * autoBroadcastJoinThresholdPercentage);
         }
     }
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java b/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java
index e1f1051315..4cf6176cdf 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java
@@ -706,7 +706,7 @@ public class ReportHandler extends Daemon {
                                 needDelete = false;
                                 ++addToMetaCounter;
                             } catch (MetaNotFoundException e) {
-                                LOG.warn("failed add to meta. tablet[{}], backend[{}]. {}",
+                                LOG.info("failed add to meta. tablet[{}], backend[{}]. {}",
                                         tabletId, backendId, e.getMessage());
                                 needDelete = true;
                             }
@@ -719,7 +719,7 @@ public class ReportHandler extends Daemon {
                         // drop replica
                         DropReplicaTask task = new DropReplicaTask(backendId, tabletId, backendTabletInfo.getSchemaHash());
                         batchTask.addTask(task);
-                        LOG.warn("delete tablet[" + tabletId + " - " + backendTabletInfo.getSchemaHash()
+                        LOG.info("delete tablet[" + tabletId + " - " + backendTabletInfo.getSchemaHash()
                                 + "] from backend[" + backendId + "] because not found in meta");
                         ++deleteFromBackendCounter;
                     }


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