You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2023/12/13 03:24:59 UTC

(iotdb) branch optimize_records created (now cc0973d5efe)

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

haonan pushed a change to branch optimize_records
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at cc0973d5efe fix bug

This branch includes the following new commits:

     new 4f53fb1babf init
     new 175aadc5177 fix bug
     new a2613d7f5f6 fix bug
     new cc0973d5efe fix bug

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iotdb) 01/04: init

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4f53fb1babf78d574505ac157e422c58b7eae85f
Author: HTHou <hh...@outlook.com>
AuthorDate: Tue Dec 12 18:16:37 2023 +0800

    init
---
 .../db/storageengine/dataregion/DataRegion.java    | 141 ++++++++++++++++++---
 .../dataregion/memtable/TsFileProcessor.java       |  19 ++-
 .../dataregion/memtable/TsFileProcessorTest.java   |  16 +--
 3 files changed, 148 insertions(+), 28 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index 8b6c1d1289d..60d70608358 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -1010,7 +1010,7 @@ public class DataRegion implements IDataRegionForQuery {
       long globalLatestFlushedTime =
           lastFlushTimeMap.getGlobalFlushedTime(insertTabletNode.getDevicePath().getFullPath());
       startTime = System.nanoTime();
-      tryToUpdateBatchInsertLastCache(insertTabletNode, globalLatestFlushedTime);
+      tryToUpdateInsertTabletLastCache(insertTabletNode, globalLatestFlushedTime);
       PERFORMANCE_OVERVIEW_METRICS.recordScheduleUpdateLastCacheCost(System.nanoTime() - startTime);
 
       if (!noFailure) {
@@ -1083,7 +1083,7 @@ public class DataRegion implements IDataRegionForQuery {
     return true;
   }
 
-  private void tryToUpdateBatchInsertLastCache(InsertTabletNode node, long latestFlushedTime) {
+  private void tryToUpdateInsertTabletLastCache(InsertTabletNode node, long latestFlushedTime) {
     if (!CommonDescriptor.getInstance().getConfig().isLastCacheEnable()
         || (config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
             && node.isSyncFromLeaderWhenUsingIoTConsensus())) {
@@ -1124,29 +1124,34 @@ public class DataRegion implements IDataRegionForQuery {
     if (tsFileProcessor == null) {
       return;
     }
-
-    tsFileProcessor.insert(insertRowNode);
+    long[] costsForMetrics = new long[4];
+    tsFileProcessor.insert(insertRowNode, costsForMetrics);
+    PERFORMANCE_OVERVIEW_METRICS.recordCreateMemtableBlockCost(costsForMetrics[0]);
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemoryBlockCost(costsForMetrics[1]);
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleWalCost(costsForMetrics[2]);
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemTableCost(costsForMetrics[3]);
 
     long globalLatestFlushTime =
         lastFlushTimeMap.getGlobalFlushedTime(insertRowNode.getDevicePath().getFullPath());
 
-    long startTime = System.nanoTime();
-    tryToUpdateInsertLastCache(insertRowNode, globalLatestFlushTime);
-    PERFORMANCE_OVERVIEW_METRICS.recordScheduleUpdateLastCacheCost(System.nanoTime() - startTime);
-
     // check memtable size and may asyncTryToFlush the work memtable
     if (tsFileProcessor.shouldFlush()) {
       fileFlushPolicy.apply(this, tsFileProcessor, sequence);
     }
-  }
 
-  private void tryToUpdateInsertLastCache(InsertRowNode node, long latestFlushedTime) {
-    if (!CommonDescriptor.getInstance().getConfig().isLastCacheEnable()
-        || (config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
-            && node.isSyncFromLeaderWhenUsingIoTConsensus())) {
-      // disable updating last cache on follower
-      return;
+    if (CommonDescriptor.getInstance().getConfig().isLastCacheEnable()) {
+      if ((!config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
+          || insertRowNode.isSyncFromLeaderWhenUsingIoTConsensus())) {
+        // disable updating last cache on follower
+        long startTime = System.nanoTime();
+        tryToUpdateInsertRowLastCache(insertRowNode, globalLatestFlushTime);
+        PERFORMANCE_OVERVIEW_METRICS.recordScheduleUpdateLastCacheCost(
+            System.nanoTime() - startTime);
+      }
     }
+  }
+
+  private void tryToUpdateInsertRowLastCache(InsertRowNode node, long latestFlushedTime) {
     String[] measurements = node.getMeasurements();
     MeasurementSchema[] measurementSchemas = node.getMeasurementSchemas();
     String[] rawMeasurements = new String[measurements.length];
@@ -1171,6 +1176,53 @@ public class DataRegion implements IDataRegionForQuery {
             latestFlushedTime);
   }
 
+  private void insertToTsFileProcessors(
+      InsertRowsNode insertRowsNode, boolean[] areSequence, long[] timePartitionIds)
+      throws WriteProcessException {
+    List<Long> globalLatestFlushTimeList = new ArrayList<>();
+    List<InsertRowNode> executedInsertRowNodeList = new ArrayList<>();
+    long[] costsForMetrics = new long[4];
+    for (int i = 0; i < areSequence.length; i++) {
+      InsertRowNode insertRowNode = insertRowsNode.getInsertRowNodeList().get(i);
+      if (insertRowNode.allMeasurementFailed()) {
+        continue;
+      }
+      TsFileProcessor tsFileProcessor =
+          getOrCreateTsFileProcessor(timePartitionIds[i], areSequence[i]);
+      if (tsFileProcessor == null) {
+        continue;
+      }
+      tsFileProcessor.insert(insertRowNode, costsForMetrics);
+      executedInsertRowNodeList.add(insertRowNode);
+      globalLatestFlushTimeList.add(
+          lastFlushTimeMap.getGlobalFlushedTime(insertRowNode.getDevicePath().getFullPath()));
+
+      // check memtable size and may asyncTryToFlush the work memtable
+      if (tsFileProcessor.shouldFlush()) {
+        fileFlushPolicy.apply(this, tsFileProcessor, areSequence[i]);
+      }
+    }
+
+    PERFORMANCE_OVERVIEW_METRICS.recordCreateMemtableBlockCost(costsForMetrics[0]);
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemoryBlockCost(costsForMetrics[1]);
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleWalCost(costsForMetrics[2]);
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemTableCost(costsForMetrics[3]);
+
+    if (CommonDescriptor.getInstance().getConfig().isLastCacheEnable()) {
+      if ((!config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
+          || insertRowsNode.isSyncFromLeaderWhenUsingIoTConsensus())) {
+        // disable updating last cache on follower
+        long startTime = System.nanoTime();
+        for (int i = 0; i < executedInsertRowNodeList.size(); i++) {
+          tryToUpdateInsertRowLastCache(
+              executedInsertRowNodeList.get(i), globalLatestFlushTimeList.get(i));
+        }
+        PERFORMANCE_OVERVIEW_METRICS.recordScheduleUpdateLastCacheCost(
+            System.nanoTime() - startTime);
+      }
+    }
+  }
+
   /**
    * WAL module uses this method to flush memTable
    *
@@ -3040,6 +3092,65 @@ public class DataRegion implements IDataRegionForQuery {
     }
   }
 
+  public void insertNew(InsertRowsNode insertRowsNode) throws WriteProcessException {
+    if (enableMemControl) {
+      StorageEngine.blockInsertionIfReject(null);
+    }
+    long startTime = System.nanoTime();
+    writeLock("InsertRows");
+    PERFORMANCE_OVERVIEW_METRICS.recordScheduleLockCost(System.nanoTime() - startTime);
+    try {
+      if (deleted) {
+        return;
+      }
+      boolean[] areSequence = new boolean[insertRowsNode.getInsertRowNodeList().size()];
+      long[] timePartitionIds = new long[insertRowsNode.getInsertRowNodeList().size()];
+      for (int i = 0; i < insertRowsNode.getInsertRowNodeList().size(); i++) {
+        InsertRowNode insertRowNode = insertRowsNode.getInsertRowNodeList().get(i);
+        if (!isAlive(insertRowNode.getTime())) {
+          insertRowsNode
+              .getResults()
+              .put(
+                  i,
+                  RpcUtils.getStatus(
+                      TSStatusCode.OUT_OF_TTL.getStatusCode(),
+                      String.format(
+                          "Insertion time [%s] is less than ttl time bound [%s]",
+                          DateTimeUtils.convertLongToDate(insertRowNode.getTime()),
+                          DateTimeUtils.convertLongToDate(
+                              CommonDateTimeUtils.currentTime() - dataTTL))));
+          continue;
+        }
+        // init map
+        timePartitionIds[i] = TimePartitionUtils.getTimePartitionId(insertRowNode.getTime());
+
+        if (!lastFlushTimeMap.checkAndCreateFlushedTimePartition(timePartitionIds[i])) {
+          TimePartitionManager.getInstance()
+              .registerTimePartitionInfo(
+                  new TimePartitionInfo(
+                      new DataRegionId(Integer.parseInt(dataRegionId)),
+                      timePartitionIds[i],
+                      true,
+                      Long.MAX_VALUE,
+                      0,
+                      tsFileManager.isLatestTimePartition(timePartitionIds[i])));
+        }
+        areSequence[i] =
+            insertRowNode.getTime()
+                > lastFlushTimeMap.getFlushedTime(
+                    timePartitionIds[i], insertRowNode.getDevicePath().getFullPath());
+        // is unsequence and user set config to discard out of order data
+        if (!areSequence[i]
+            && IoTDBDescriptor.getInstance().getConfig().isEnableDiscardOutOfOrderData()) {
+          return;
+        }
+      }
+      insertToTsFileProcessors(insertRowsNode, areSequence, timePartitionIds);
+    } finally {
+      writeUnlock();
+    }
+  }
+
   /**
    * insert batch of tablets belongs to multiple devices
    *
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
index 7fadcda4267..77d3ec805b4 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
@@ -238,12 +238,15 @@ public class TsFileProcessor {
    *
    * @param insertRowNode physical plan of insertion
    */
-  public void insert(InsertRowNode insertRowNode) throws WriteProcessException {
+  public void insert(InsertRowNode insertRowNode, long[] costsForMetrics)
+      throws WriteProcessException {
 
     if (workMemTable == null) {
       long startTime = System.nanoTime();
       createNewWorkingMemTable();
-      PERFORMANCE_OVERVIEW_METRICS.recordCreateMemtableBlockCost(System.nanoTime() - startTime);
+      // recordCreateMemtableBlockCost
+      costsForMetrics[0] += System.nanoTime() - startTime;
+      // PERFORMANCE_OVERVIEW_METRICS.recordCreateMemtableBlockCost(System.nanoTime() - startTime);
     }
 
     long[] memIncrements = null;
@@ -260,7 +263,9 @@ public class TsFileProcessor {
                 insertRowNode.getDevicePath().getFullPath(), insertRowNode.getMeasurements(),
                 insertRowNode.getDataTypes(), insertRowNode.getValues());
       }
-      PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemoryBlockCost(System.nanoTime() - startTime);
+      // recordScheduleMemoryBlockCost
+      costsForMetrics[1] += System.nanoTime() - startTime;
+      // PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemoryBlockCost(System.nanoTime() - startTime);
     }
 
     long startTime = System.nanoTime();
@@ -280,7 +285,9 @@ public class TsFileProcessor {
               storageGroupName, tsFileResource.getTsFile().getAbsolutePath()),
           e);
     } finally {
-      PERFORMANCE_OVERVIEW_METRICS.recordScheduleWalCost(System.nanoTime() - startTime);
+      // recordScheduleWalCost
+      costsForMetrics[2] += System.nanoTime() - startTime;
+      // PERFORMANCE_OVERVIEW_METRICS.recordScheduleWalCost(System.nanoTime() - startTime);
     }
 
     startTime = System.nanoTime();
@@ -310,8 +317,10 @@ public class TsFileProcessor {
     }
 
     tsFileResource.updateProgressIndex(insertRowNode.getProgressIndex());
+    // recordScheduleMemTableCost
+    costsForMetrics[3] += System.nanoTime() - startTime;
 
-    PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemTableCost(System.nanoTime() - startTime);
+    // PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemTableCost(System.nanoTime() - startTime);
   }
 
   private void createNewWorkingMemTable() throws WriteProcessException {
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessorTest.java
index 1315ef4cc84..1abb9cec674 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessorTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessorTest.java
@@ -129,7 +129,7 @@ public class TsFileProcessorTest {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
 
     // query data in memory
@@ -188,7 +188,7 @@ public class TsFileProcessorTest {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
 
     // query data in memory
@@ -273,7 +273,7 @@ public class TsFileProcessorTest {
       for (int i = 1; i <= 10; i++) {
         TSRecord record = new TSRecord(i, deviceId);
         record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-        processor.insert(buildInsertRowNodeByTSRecord(record));
+        processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
       }
       processor.asyncFlush();
     }
@@ -315,7 +315,7 @@ public class TsFileProcessorTest {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
     Assert.assertEquals(1598424, memTable.getTVListsRamCost());
     Assert.assertEquals(90100, memTable.getTotalPointsNum());
@@ -362,14 +362,14 @@ public class TsFileProcessorTest {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
     Assert.assertEquals(6387232, memTable.getTVListsRamCost());
     // Test records
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, "s1", String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
     Assert.assertEquals(6388848, memTable.getTVListsRamCost());
     Assert.assertEquals(240200, memTable.getTotalPointsNum());
@@ -405,7 +405,7 @@ public class TsFileProcessorTest {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
     Assert.assertEquals(3193616, memTable.getTVListsRamCost());
     Assert.assertEquals(90100, memTable.getTotalPointsNum());
@@ -442,7 +442,7 @@ public class TsFileProcessorTest {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, deviceId);
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(buildInsertRowNodeByTSRecord(record));
+      processor.insert(buildInsertRowNodeByTSRecord(record), new long[4]);
     }
 
     // query data in memory


(iotdb) 04/04: fix bug

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cc0973d5efe65a79d5b3e60d871693e1b5bae92d
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Dec 13 11:24:39 2023 +0800

    fix bug
---
 .../java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index fdae2fd01cb..02d3b394771 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -1141,7 +1141,7 @@ public class DataRegion implements IDataRegionForQuery {
 
     if (CommonDescriptor.getInstance().getConfig().isLastCacheEnable()) {
       if ((!config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
-          || insertRowNode.isSyncFromLeaderWhenUsingIoTConsensus())) {
+          || !insertRowNode.isSyncFromLeaderWhenUsingIoTConsensus())) {
         // disable updating last cache on follower
         long startTime = System.nanoTime();
         tryToUpdateInsertRowLastCache(insertRowNode, globalLatestFlushTime);


(iotdb) 02/04: fix bug

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 175aadc5177f529de9d35e0f836f30081fe43084
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Dec 13 09:46:38 2023 +0800

    fix bug
---
 .../db/consensus/statemachine/dataregion/DataExecutionVisitor.java    | 2 +-
 .../java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataExecutionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataExecutionVisitor.java
index 53813fb93ea..fe224531267 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataExecutionVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataExecutionVisitor.java
@@ -94,7 +94,7 @@ public class DataExecutionVisitor extends PlanVisitor<TSStatus, DataRegion> {
     try {
       dataRegion.insert(node);
       return StatusUtils.OK;
-    } catch (BatchProcessException e) {
+    } catch (WriteProcessException e) {
       LOGGER.warn("Batch failure in executing a InsertRowsNode.");
       TSStatus firstStatus = null;
       // for each error
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index 60d70608358..1be336cce0a 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -3077,7 +3077,7 @@ public class DataRegion implements IDataRegionForQuery {
    *
    * @param insertRowsNode batch of rows belongs to multiple devices
    */
-  public void insert(InsertRowsNode insertRowsNode) throws BatchProcessException {
+  public void insertOld(InsertRowsNode insertRowsNode) throws BatchProcessException {
     for (int i = 0; i < insertRowsNode.getInsertRowNodeList().size(); i++) {
       InsertRowNode insertRowNode = insertRowsNode.getInsertRowNodeList().get(i);
       try {
@@ -3092,7 +3092,7 @@ public class DataRegion implements IDataRegionForQuery {
     }
   }
 
-  public void insertNew(InsertRowsNode insertRowsNode) throws WriteProcessException {
+  public void insert(InsertRowsNode insertRowsNode) throws WriteProcessException {
     if (enableMemControl) {
       StorageEngine.blockInsertionIfReject(null);
     }


(iotdb) 03/04: fix bug

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a2613d7f5f68d3c36862382864f045263ad4ea20
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Dec 13 11:08:52 2023 +0800

    fix bug
---
 .../java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index 1be336cce0a..fdae2fd01cb 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -1210,7 +1210,7 @@ public class DataRegion implements IDataRegionForQuery {
 
     if (CommonDescriptor.getInstance().getConfig().isLastCacheEnable()) {
       if ((!config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.IOT_CONSENSUS)
-          || insertRowsNode.isSyncFromLeaderWhenUsingIoTConsensus())) {
+          || !insertRowsNode.isSyncFromLeaderWhenUsingIoTConsensus())) {
         // disable updating last cache on follower
         long startTime = System.nanoTime();
         for (int i = 0; i < executedInsertRowNodeList.size(); i++) {