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

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


The following commit(s) were added to refs/heads/master by this push:
     new b9f1ac153af [improvement](profile) do not remove value 0 counter 
(#24487)
b9f1ac153af is described below

commit b9f1ac153afc70c5032c3473c1702ed0590ee5a3
Author: Mryange <59914473+mrya...@users.noreply.github.com>
AuthorDate: Mon Sep 18 15:31:19 2023 +0800

    [improvement](profile) do not remove value 0 counter (#24487)
    
    do not remove value 0 counter
---
 .../src/main/java/org/apache/doris/common/util/Counter.java      | 9 +++++++++
 .../main/java/org/apache/doris/common/util/RuntimeProfile.java   | 8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
index 5bc4aa2ead0..77baf3ecd83 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
@@ -23,6 +23,7 @@ import org.apache.doris.thrift.TUnit;
 public class Counter {
     private volatile long value;
     private volatile int type;
+    private volatile boolean remove = false;
 
     public long getValue() {
         return value;
@@ -68,4 +69,12 @@ public class Counter {
         TUnit ttype = TUnit.findByValue(type);
         return ttype == TUnit.TIME_MS || ttype == TUnit.TIME_NS || ttype == 
TUnit.TIME_S;
     }
+
+    public void setCanRemove() {
+        this.remove = true;
+    }
+
+    public boolean isRemove() {
+        return this.remove;
+    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
index a69ecb5d100..1b8a1f02380 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
@@ -399,7 +399,7 @@ public class RuntimeProfile {
 
             mergeProfileCounter(src, childCounterName, rhs);
             mergeCounter(src, childCounterName, counter, rhsCounter);
-            removeZeroeCounter(childCounterSet, childCounterName, counter);
+            removeCounter(childCounterSet, childCounterName, counter);
 
         }
     }
@@ -423,8 +423,8 @@ public class RuntimeProfile {
         }
     }
 
-    private static void removeZeroeCounter(Set<String> childCounterSet, String 
childCounterName, Counter counter) {
-        if (counter.getValue() == 0) {
+    private static void removeCounter(Set<String> childCounterSet, String 
childCounterName, Counter counter) {
+        if (counter.isRemove()) {
             childCounterSet.remove(childCounterName);
         }
     }
@@ -476,7 +476,7 @@ public class RuntimeProfile {
                         + MIN_TIME_PRE + printCounter(minCounter.getValue(), 
minCounter.getType()) + " ]";
                 src.infoStrings.put(counterName, infoString);
             }
-            counter.setValue(0); // value 0 will remove in removeZeroeCounter
+            counter.setCanRemove(); // value will remove in removeCounter
         } else {
             if (rhsCounter.size() == 0) {
                 return;


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

Reply via email to