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

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

commit c46cd432eb095272eef55cde173ce2631acd1dbf
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Thu Jan 12 11:40:48 2023 +0800

    fix data partition update error
---
 .../org/apache/iotdb/db/mpp/plan/analyze/cache/PartitionCache.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/cache/PartitionCache.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/cache/PartitionCache.java
index ea23bc4fca..26e60f8782 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/cache/PartitionCache.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/cache/PartitionCache.java
@@ -749,9 +749,9 @@ public class PartitionCache {
         String storageGroupName = entry1.getKey();
         if (null != storageGroupName) {
           DataPartitionTable result = 
dataPartitionCache.getIfPresent(storageGroupName);
-          if (null == result) {
+          boolean needToUpdateCache = (null == result);
+          if (needToUpdateCache) {
             result = new DataPartitionTable();
-            dataPartitionCache.put(storageGroupName, result);
           }
           Map<TSeriesPartitionSlot, SeriesPartitionTable>
               seriesPartitionSlotSeriesPartitionTableMap = 
result.getDataPartitionMap();
@@ -775,6 +775,9 @@ public class PartitionCache {
               }
             }
           }
+          if (needToUpdateCache) {
+            dataPartitionCache.put(storageGroupName, result);
+          }
         }
       }
     } finally {

Reply via email to