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 2022/01/25 02:54:04 UTC

[iotdb] branch _2433 created (now 501c829)

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

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


      at 501c829  [IOTDB-2433] Fix insert aligned timeseries performance reduction

This branch includes the following new commits:

     new 501c829  [IOTDB-2433] Fix insert aligned timeseries performance reduction

The 1 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/01: [IOTDB-2433] Fix insert aligned timeseries performance reduction

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

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

commit 501c8292b46b3bd50296ea42cb8d73790ece5f7b
Author: HTHou <hh...@outlook.com>
AuthorDate: Tue Jan 25 10:46:24 2022 +0800

    [IOTDB-2433] Fix insert aligned timeseries performance reduction
---
 .../org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java   | 1 -
 .../apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java   | 7 ++++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java
index f411622..8dd7998 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBDeletionIT.java
@@ -189,7 +189,6 @@ public class IoTDBDeletionIT {
   }
 
   @Test
-  @Ignore // TODO
   public void testMerge() throws SQLException {
     prepareMerge();
 
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java
index 2339f51..cef4c5d 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -167,9 +168,9 @@ public class AlignedWritableMemChunk implements IWritableMemChunk {
   }
 
   private int[] checkColumnsInInsertPlan(List<IMeasurementSchema> schemaListInInsertPlan) {
-    List<String> measurementIdsInInsertPlan = new ArrayList<>();
+    Map<String, Integer> measurementIdsInInsertPlan = new HashMap<>();
     for (int i = 0; i < schemaListInInsertPlan.size(); i++) {
-      measurementIdsInInsertPlan.add(schemaListInInsertPlan.get(i).getMeasurementId());
+      measurementIdsInInsertPlan.put(schemaListInInsertPlan.get(i).getMeasurementId(), i);
       if (!containsMeasurement(schemaListInInsertPlan.get(i).getMeasurementId())) {
         this.measurementIndexMap.put(
             schemaListInInsertPlan.get(i).getMeasurementId(), measurementIndexMap.size());
@@ -180,7 +181,7 @@ public class AlignedWritableMemChunk implements IWritableMemChunk {
     int[] columnIndexArray = new int[measurementIndexMap.size()];
     measurementIndexMap.forEach(
         (measurementId, i) -> {
-          columnIndexArray[i] = measurementIdsInInsertPlan.indexOf(measurementId);
+          columnIndexArray[i] = measurementIdsInInsertPlan.getOrDefault(measurementId, -1);
         });
     return columnIndexArray;
   }