You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ej...@apache.org on 2021/05/21 07:21:32 UTC

[iotdb] branch dynamic_compaction updated: fix null pointer

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

ejttianyu pushed a commit to branch dynamic_compaction
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dynamic_compaction by this push:
     new e5af3f2  fix null pointer
e5af3f2 is described below

commit e5af3f24134844baa39340f16c14187abe5d16fe
Author: EJTTianyu <16...@qq.com>
AuthorDate: Fri May 21 15:20:56 2021 +0800

    fix null pointer
---
 .../apache/iotdb/db/engine/heavyhitter/hitter/HashMapHitter.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/heavyhitter/hitter/HashMapHitter.java b/server/src/main/java/org/apache/iotdb/db/engine/heavyhitter/hitter/HashMapHitter.java
index 8f98118..6e6d5a7 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/heavyhitter/hitter/HashMapHitter.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/heavyhitter/hitter/HashMapHitter.java
@@ -47,10 +47,13 @@ public class HashMapHitter implements QueryHeavyHitters {
   private final ReadWriteLock hitterLock = new ReentrantReadWriteLock();
   int hitter = IoTDBDescriptor.getInstance().getConfig().getMaxHitterNum();
   private Map<PartialPath, Integer> counter = new HashMap<>();
-  private PriorityQueue<Entry<PartialPath, Integer>> topHeap = new PriorityQueue<>(hitter,
+  private PriorityQueue<Entry<PartialPath, Integer>> topHeap = new PriorityQueue<>(
       new Comparator<Entry<PartialPath, Integer>>() {
         @Override
         public int compare(Entry<PartialPath, Integer> o1, Entry<PartialPath, Integer> o2) {
+          if (o1 == null || o2 == null) {
+            System.out.println("mdzz");
+          }
           return o2.getValue() - o1.getValue();
         }
       });
@@ -63,6 +66,9 @@ public class HashMapHitter implements QueryHeavyHitters {
   public void acceptQuerySeries(PartialPath queryPath) {
     hitterLock.writeLock().lock();
     try {
+      if (queryPath == null) {
+        return;
+      }
       counter.put(queryPath, counter.getOrDefault(queryPath, 0) + 1);
     } finally {
       hitterLock.writeLock().unlock();