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 5bc4aa2ead..77baf3ecd8 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 a69ecb5d10..1b8a1f0238 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 childCounterSet, String childCounterName, Counter counter) { - if (counter.getValue() == 0) { + private static void removeCounter(Set 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;