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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9e79d85b7a8 peformance regression of sequential inserting (#14951)
9e79d85b7a8 is described below

commit 9e79d85b7a83673073ce381099d3983febf94084
Author: shizy <[email protected]>
AuthorDate: Wed Feb 26 18:52:44 2025 +0800

    peformance regression of sequential inserting (#14951)
---
 .../dataregion/memtable/AbstractMemTable.java      |  9 +++++
 .../memtable/AlignedWritableMemChunkGroup.java     |  5 +++
 .../dataregion/memtable/IMemTable.java             |  2 +
 .../memtable/IWritableMemChunkGroup.java           |  2 +
 .../dataregion/memtable/TsFileProcessor.java       | 41 +++++++++++++-------
 .../dataregion/memtable/WritableMemChunkGroup.java |  8 ++++
 .../db/utils/datastructure/AlignedTVList.java      | 44 ++++++++++------------
 .../iotdb/db/utils/datastructure/BinaryTVList.java | 25 ++++++------
 .../db/utils/datastructure/BooleanTVList.java      | 25 ++++++------
 .../iotdb/db/utils/datastructure/DoubleTVList.java | 25 ++++++------
 .../iotdb/db/utils/datastructure/FloatTVList.java  | 25 ++++++------
 .../iotdb/db/utils/datastructure/IntTVList.java    | 25 ++++++------
 .../iotdb/db/utils/datastructure/LongTVList.java   | 25 ++++++------
 .../iotdb/db/utils/datastructure/TVList.java       | 43 ++++++++++++++-------
 .../dataregion/memtable/TsFileProcessorTest.java   | 36 +++++++++---------
 15 files changed, 205 insertions(+), 135 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
index ab6fba9b756..ffb7d22acf6 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
@@ -382,6 +382,15 @@ public abstract class AbstractMemTable implements 
IMemTable {
     return memChunkGroup.getMeasurementSize(measurement);
   }
 
+  @Override
+  public IWritableMemChunk getWritableMemChunk(IDeviceID deviceId, String 
measurement) {
+    IWritableMemChunkGroup memChunkGroup = memTableMap.get(deviceId);
+    if (null == memChunkGroup) {
+      return null;
+    }
+    return memChunkGroup.getWritableMemChunk(measurement);
+  }
+
   @Override
   public int getSeriesNumber() {
     return seriesNumber;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkGroup.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkGroup.java
index cd90daf4870..36c8470af2c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkGroup.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkGroup.java
@@ -142,6 +142,11 @@ public class AlignedWritableMemChunkGroup implements 
IWritableMemChunkGroup {
     return memChunk.rowCount();
   }
 
+  @Override
+  public IWritableMemChunk getWritableMemChunk(String measurement) {
+    return memChunk;
+  }
+
   @Override
   public long getMaxTime() {
     return memChunk.getMaxTime();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IMemTable.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IMemTable.java
index f93a368ca6f..dcf927b0c63 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IMemTable.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IMemTable.java
@@ -171,6 +171,8 @@ public interface IMemTable extends WALEntryValue {
   /** only used when mem control enabled */
   long getMeasurementSize(IDeviceID deviceId, String measurement);
 
+  IWritableMemChunk getWritableMemChunk(IDeviceID deviceId, String 
measurement);
+
   /** only used when mem control enabled */
   void addTextDataSize(long textDataIncrement);
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IWritableMemChunkGroup.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IWritableMemChunkGroup.java
index 52686ce9f77..382573e7450 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IWritableMemChunkGroup.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IWritableMemChunkGroup.java
@@ -58,5 +58,7 @@ public interface IWritableMemChunkGroup extends WALEntryValue 
{
 
   long getMeasurementSize(String measurement);
 
+  IWritableMemChunk getWritableMemChunk(String measurement);
+
   long getMaxTime();
 }
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 7a5b61544fd..6c2e503e67a 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
@@ -659,10 +659,11 @@ public class TsFileProcessor {
       } else {
         // here currentChunkPointNum >= 1
         long currentChunkPointNum = workMemTable.getMeasurementSize(deviceId, 
measurements[i]);
-        memTableIncrement +=
-            (currentChunkPointNum % PrimitiveArrayManager.ARRAY_SIZE) == 0
-                ? TVList.tvListArrayMemCost(dataTypes[i])
-                : 0;
+        IWritableMemChunk memChunk = 
workMemTable.getWritableMemChunk(deviceId, measurements[i]);
+        if (currentChunkPointNum % PrimitiveArrayManager.ARRAY_SIZE == 0) {
+          memTableIncrement +=
+              memChunk != null ? 
memChunk.getWorkingTVList().tvListArrayMemCost() : 0;
+        }
       }
       // TEXT data mem size
       if (dataTypes[i].isBinary() && values[i] != null) {
@@ -704,14 +705,17 @@ public class TsFileProcessor {
         } else {
           // here currentChunkPointNum >= 1
           long currentChunkPointNum = 
workMemTable.getMeasurementSize(deviceId, measurements[i]);
+          IWritableMemChunk memChunk = 
workMemTable.getWritableMemChunk(deviceId, measurements[i]);
           int addingPointNum =
               increasingMemTableInfo
                   .computeIfAbsent(deviceId, k -> new HashMap<>())
                   .computeIfAbsent(measurements[i], k -> 0);
-          memTableIncrement +=
-              ((currentChunkPointNum + addingPointNum) % 
PrimitiveArrayManager.ARRAY_SIZE) == 0
-                  ? TVList.tvListArrayMemCost(dataTypes[i])
-                  : 0;
+          if ((currentChunkPointNum + addingPointNum) % 
PrimitiveArrayManager.ARRAY_SIZE == 0) {
+            memTableIncrement +=
+                memChunk != null
+                    ? memChunk.getWorkingTVList().tvListArrayMemCost()
+                    : TVList.tvListArrayMemCost(dataTypes[i]);
+          }
           
increasingMemTableInfo.get(deviceId).computeIfPresent(measurements[i], (k, v) 
-> v + 1);
         }
         // TEXT data mem size
@@ -773,7 +777,7 @@ public class TsFileProcessor {
       if ((alignedMemChunk.alignedListSize() % 
PrimitiveArrayManager.ARRAY_SIZE) == 0) {
         dataTypesInTVList.addAll(
             ((AlignedTVList) 
alignedMemChunk.getWorkingTVList()).getTsDataTypes());
-        memTableIncrement += 
AlignedTVList.alignedTvListArrayMemCost(dataTypesInTVList);
+        memTableIncrement += 
alignedMemChunk.getWorkingTVList().alignedTvListArrayMemCost();
       }
     }
 
@@ -867,7 +871,11 @@ public class TsFileProcessor {
                 ((AlignedTVList) 
alignedMemChunk.getWorkingTVList()).getTsDataTypes());
           }
           dataTypesInTVList.addAll(addingPointNumInfo.left.values());
-          memTableIncrement += 
AlignedTVList.alignedTvListArrayMemCost(dataTypesInTVList);
+          memTableIncrement +=
+              alignedMemChunk != null
+                  ? 
alignedMemChunk.getWorkingTVList().alignedTvListArrayMemCost()
+                  : AlignedTVList.alignedTvListArrayMemCost(
+                      dataTypesInTVList.toArray(new TSDataType[0]), null);
         }
         addingPointNumInfo.setRight(addingPointNum + 1);
       }
@@ -969,16 +977,23 @@ public class TsFileProcessor {
               * TVList.tvListArrayMemCost(dataType);
     } else {
       long currentChunkPointNum = workMemTable.getMeasurementSize(deviceId, 
measurement);
+      IWritableMemChunk memChunk = workMemTable.getWritableMemChunk(deviceId, 
measurement);
       if (currentChunkPointNum % PrimitiveArrayManager.ARRAY_SIZE == 0) {
         memIncrements[0] +=
             ((end - start) / PrimitiveArrayManager.ARRAY_SIZE + 1)
-                * TVList.tvListArrayMemCost(dataType);
+                * (memChunk != null
+                    ? memChunk.getWorkingTVList().tvListArrayMemCost()
+                    : TVList.tvListArrayMemCost(dataType));
       } else {
         long acquireArray =
             (end - start - 1 + (currentChunkPointNum % 
PrimitiveArrayManager.ARRAY_SIZE))
                 / PrimitiveArrayManager.ARRAY_SIZE;
         if (acquireArray != 0) {
-          memIncrements[0] += acquireArray * 
TVList.tvListArrayMemCost(dataType);
+          memIncrements[0] +=
+              acquireArray
+                  * (memChunk != null
+                      ? memChunk.getWorkingTVList().tvListArrayMemCost()
+                      : TVList.tvListArrayMemCost(dataType));
         }
       }
     }
@@ -1078,7 +1093,7 @@ public class TsFileProcessor {
         dataTypesInTVList.addAll(
             ((AlignedTVList) 
alignedMemChunk.getWorkingTVList()).getTsDataTypes());
         memIncrements[0] +=
-            acquireArray * 
AlignedTVList.alignedTvListArrayMemCost(dataTypesInTVList);
+            acquireArray * 
alignedMemChunk.getWorkingTVList().alignedTvListArrayMemCost();
       }
     }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunkGroup.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunkGroup.java
index 0da39435d32..e47debd9d73 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunkGroup.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunkGroup.java
@@ -153,6 +153,14 @@ public class WritableMemChunkGroup implements 
IWritableMemChunkGroup {
     return memChunkMap.get(measurement).rowCount();
   }
 
+  @Override
+  public IWritableMemChunk getWritableMemChunk(String measurement) {
+    if (!memChunkMap.containsKey(measurement)) {
+      return null;
+    }
+    return memChunkMap.get(measurement);
+  }
+
   @Override
   public long getMaxTime() {
     long maxTime = Long.MIN_VALUE;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
index 62224ee3871..7fb8e07ae92 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
@@ -228,7 +228,9 @@ public abstract class AlignedTVList extends TVList {
           break;
       }
     }
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -261,9 +263,8 @@ public abstract class AlignedTVList extends TVList {
     if (index >= rowCount) {
       throw new ArrayIndexOutOfBoundsException(index);
     }
-    int arrayIndex = index / ARRAY_SIZE;
-    int elementIndex = index % ARRAY_SIZE;
-    int valueIndex = indices.get(arrayIndex)[elementIndex];
+    int valueIndex =
+        (indices != null) ? indices.get(index / ARRAY_SIZE)[index % 
ARRAY_SIZE] : index;
     return getAlignedValueByValueIndex(valueIndex, null, floatPrecision, 
encodingList);
   }
 
@@ -692,7 +693,9 @@ public abstract class AlignedTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     for (int i = 0; i < dataTypes.size(); i++) {
       values.get(i).add(getPrimitiveArraysByType(dataTypes.get(i)));
       if (bitMaps != null && bitMaps.get(i) != null) {
@@ -750,14 +753,6 @@ public abstract class AlignedTVList extends TVList {
         time, (TsPrimitiveType) getAlignedValueForQuery(index, floatPrecision, 
encodingList));
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(indices.remove(indices.size() - 1));
-    for (List<Object> valueList : values) {
-      PrimitiveArrayManager.release(valueList.remove(valueList.size() - 1));
-    }
-  }
-
   @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity 
warning
   @Override
   public synchronized void putAlignedValues(
@@ -777,7 +772,9 @@ public abstract class AlignedTVList extends TVList {
         System.arraycopy(time, idx, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         arrayCopy(value, idx, arrayIdx, elementIdx, inputRemaining);
         for (int i = 0; i < inputRemaining; i++) {
-          indices.get(arrayIdx)[elementIdx + i] = rowCount;
+          if (indices != null) {
+            indices.get(arrayIdx)[elementIdx + i] = rowCount;
+          }
           for (int j = 0; j < values.size(); j++) {
             if (value[j] == null
                 || bitMaps != null && bitMaps[j] != null && 
bitMaps[j].isMarked(idx + i)
@@ -796,7 +793,9 @@ public abstract class AlignedTVList extends TVList {
         System.arraycopy(time, idx, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         arrayCopy(value, idx, arrayIdx, elementIdx, internalRemaining);
         for (int i = 0; i < internalRemaining; i++) {
-          indices.get(arrayIdx)[elementIdx + i] = rowCount;
+          if (indices != null) {
+            indices.get(arrayIdx)[elementIdx + i] = rowCount;
+          }
           for (int j = 0; j < values.size(); j++) {
             if (value[j] == null
                 || bitMaps != null && bitMaps[j] != null && 
bitMaps[j].isMarked(idx + i)
@@ -895,7 +894,7 @@ public abstract class AlignedTVList extends TVList {
 
   @Override
   public long calculateRamSize() {
-    return timestamps.size() * alignedTvListArrayMemCost(dataTypes);
+    return timestamps.size() * alignedTvListArrayMemCost();
   }
 
   /**
@@ -925,8 +924,6 @@ public abstract class AlignedTVList extends TVList {
     }
     // time array mem size
     size += PrimitiveArrayManager.ARRAY_SIZE * 8L;
-    // index array mem size
-    size += PrimitiveArrayManager.ARRAY_SIZE * 4L;
     // array headers mem size
     size += (long) NUM_BYTES_ARRAY_HEADER * (2 + measurementColumnNum);
     // Object references size in ArrayList
@@ -937,13 +934,12 @@ public abstract class AlignedTVList extends TVList {
   /**
    * Get the single alignedTVList array mem cost by give types.
    *
-   * @param types the types in the vector
    * @return AlignedTvListArrayMemSize
    */
-  public static long alignedTvListArrayMemCost(List<TSDataType> types) {
+  public long alignedTvListArrayMemCost() {
     long size = 0;
     // value & bitmap array mem size
-    for (TSDataType type : types) {
+    for (TSDataType type : dataTypes) {
       if (type != null) {
         size += (long) PrimitiveArrayManager.ARRAY_SIZE * (long) 
type.getDataTypeSize();
         size += (long) PrimitiveArrayManager.ARRAY_SIZE / 8 + 1;
@@ -956,11 +952,11 @@ public abstract class AlignedTVList extends TVList {
     // time array mem size
     size += PrimitiveArrayManager.ARRAY_SIZE * 8L;
     // index array mem size
-    size += PrimitiveArrayManager.ARRAY_SIZE * 4L;
+    size += (indices != null) ? PrimitiveArrayManager.ARRAY_SIZE * 4L : 0;
     // array headers mem size
-    size += (long) NUM_BYTES_ARRAY_HEADER * (2 + types.size());
+    size += (long) NUM_BYTES_ARRAY_HEADER * (2 + dataTypes.size());
     // Object references size in ArrayList
-    size += (long) NUM_BYTES_OBJECT_REF * (2 + types.size());
+    size += (long) NUM_BYTES_OBJECT_REF * (2 + dataTypes.size());
     return size;
   }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
index 5e1510e6467..1c5a1265a84 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
@@ -89,7 +89,9 @@ public abstract class BinaryTVList extends TVList {
     minTime = Math.min(minTime, timestamp);
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
     values.get(arrayIndex)[elementIndex] = value;
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -123,7 +125,9 @@ public abstract class BinaryTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     values.add((Binary[]) getPrimitiveArraysByType(TSDataType.TEXT));
     if (bitMap != null) {
       bitMap.add(null);
@@ -160,11 +164,6 @@ public abstract class BinaryTVList extends TVList {
     }
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(values.remove(values.size() - 1));
-  }
-
   @Override
   public synchronized void putBinaries(
       long[] time, Binary[] value, BitMap bitMap, int start, int end) {
@@ -201,8 +200,10 @@ public abstract class BinaryTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
inputRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        }
         rowCount += inputRemaining;
         break;
       } else {
@@ -211,8 +212,10 @@ public abstract class BinaryTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
internalRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        }
         idx += internalRemaining;
         rowCount += internalRemaining;
         checkExpansion();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BooleanTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BooleanTVList.java
index 9da6cde836e..0037bf72308 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BooleanTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BooleanTVList.java
@@ -88,7 +88,9 @@ public abstract class BooleanTVList extends TVList {
     minTime = Math.min(minTime, timestamp);
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
     values.get(arrayIndex)[elementIndex] = value;
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -122,7 +124,9 @@ public abstract class BooleanTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     values.add((boolean[]) getPrimitiveArraysByType(TSDataType.BOOLEAN));
     if (bitMap != null) {
       bitMap.add(null);
@@ -160,11 +164,6 @@ public abstract class BooleanTVList extends TVList {
     }
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(values.remove(values.size() - 1));
-  }
-
   @Override
   public synchronized void putBooleans(
       long[] time, boolean[] value, BitMap bitMap, int start, int end) {
@@ -201,8 +200,10 @@ public abstract class BooleanTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
inputRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        }
         rowCount += inputRemaining;
         break;
       } else {
@@ -211,8 +212,10 @@ public abstract class BooleanTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
internalRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        }
         idx += internalRemaining;
         rowCount += internalRemaining;
         checkExpansion();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
index d94e234d162..48c7c58046d 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
@@ -89,7 +89,9 @@ public abstract class DoubleTVList extends TVList {
     minTime = Math.min(minTime, timestamp);
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
     values.get(arrayIndex)[elementIndex] = value;
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -123,7 +125,9 @@ public abstract class DoubleTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     values.add((double[]) getPrimitiveArraysByType(TSDataType.DOUBLE));
     if (bitMap != null) {
       bitMap.add(null);
@@ -166,11 +170,6 @@ public abstract class DoubleTVList extends TVList {
     }
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(values.remove(values.size() - 1));
-  }
-
   @Override
   public synchronized void putDoubles(
       long[] time, double[] value, BitMap bitMap, int start, int end) {
@@ -207,8 +206,10 @@ public abstract class DoubleTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
inputRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        }
         rowCount += inputRemaining;
         break;
       } else {
@@ -217,8 +218,10 @@ public abstract class DoubleTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
internalRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        }
         idx += internalRemaining;
         rowCount += internalRemaining;
         checkExpansion();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
index ba4989190d6..a0a23bd2b1c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
@@ -89,7 +89,9 @@ public abstract class FloatTVList extends TVList {
     minTime = Math.min(minTime, timestamp);
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
     values.get(arrayIndex)[elementIndex] = value;
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -123,7 +125,9 @@ public abstract class FloatTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     values.add((float[]) getPrimitiveArraysByType(TSDataType.FLOAT));
     if (bitMap != null) {
       bitMap.add(null);
@@ -166,11 +170,6 @@ public abstract class FloatTVList extends TVList {
     }
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(values.remove(values.size() - 1));
-  }
-
   @Override
   public synchronized void putFloats(
       long[] time, float[] value, BitMap bitMap, int start, int end) {
@@ -207,8 +206,10 @@ public abstract class FloatTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
inputRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        }
         rowCount += inputRemaining;
         break;
       } else {
@@ -217,8 +218,10 @@ public abstract class FloatTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
internalRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        }
         idx += internalRemaining;
         rowCount += internalRemaining;
         checkExpansion();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/IntTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/IntTVList.java
index 078c85f9ce8..5611ea700e8 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/IntTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/IntTVList.java
@@ -88,7 +88,9 @@ public abstract class IntTVList extends TVList {
     minTime = Math.min(minTime, timestamp);
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
     values.get(arrayIndex)[elementIndex] = value;
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -122,7 +124,9 @@ public abstract class IntTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     values.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
     if (bitMap != null) {
       bitMap.add(null);
@@ -159,11 +163,6 @@ public abstract class IntTVList extends TVList {
     }
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(values.remove(values.size() - 1));
-  }
-
   @Override
   public synchronized void putInts(long[] time, int[] value, BitMap bitMap, 
int start, int end) {
     checkExpansion();
@@ -199,8 +198,10 @@ public abstract class IntTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
inputRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        }
         rowCount += inputRemaining;
         break;
       } else {
@@ -209,8 +210,10 @@ public abstract class IntTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
internalRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        }
         idx += internalRemaining;
         rowCount += internalRemaining;
         checkExpansion();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/LongTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/LongTVList.java
index ed9671c7f11..e5f360c6635 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/LongTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/LongTVList.java
@@ -88,7 +88,9 @@ public abstract class LongTVList extends TVList {
     minTime = Math.min(minTime, timestamp);
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
     values.get(arrayIndex)[elementIndex] = value;
-    indices.get(arrayIndex)[elementIndex] = rowCount;
+    if (indices != null) {
+      indices.get(arrayIndex)[elementIndex] = rowCount;
+    }
     rowCount++;
     if (sorted) {
       if (rowCount > 1 && timestamp < getTime(rowCount - 2)) {
@@ -122,7 +124,9 @@ public abstract class LongTVList extends TVList {
 
   @Override
   protected void expandValues() {
-    indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    if (indices != null) {
+      indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+    }
     values.add((long[]) getPrimitiveArraysByType(TSDataType.INT64));
     if (bitMap != null) {
       bitMap.add(null);
@@ -159,11 +163,6 @@ public abstract class LongTVList extends TVList {
     }
   }
 
-  @Override
-  protected void releaseLastValueArray() {
-    PrimitiveArrayManager.release(values.remove(values.size() - 1));
-  }
-
   @Override
   public synchronized void putLongs(long[] time, long[] value, BitMap bitMap, 
int start, int end) {
     checkExpansion();
@@ -199,8 +198,10 @@ public abstract class LongTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
inputRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
inputRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
inputRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
inputRemaining);
+        }
         rowCount += inputRemaining;
         break;
       } else {
@@ -209,8 +210,10 @@ public abstract class LongTVList extends TVList {
         System.arraycopy(
             time, idx - timeIdxOffset, timestamps.get(arrayIdx), elementIdx, 
internalRemaining);
         System.arraycopy(value, idx, values.get(arrayIdx), elementIdx, 
internalRemaining);
-        int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
-        System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        if (indices != null) {
+          int[] indexes = IntStream.range(rowCount, rowCount + 
internalRemaining).toArray();
+          System.arraycopy(indexes, 0, indices.get(arrayIdx), elementIdx, 
internalRemaining);
+        }
         idx += internalRemaining;
         rowCount += internalRemaining;
         checkExpansion();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
index 4e5d70519b7..d621f038286 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
@@ -86,7 +86,6 @@ public abstract class TVList implements WALEntryValue {
 
   protected TVList() {
     timestamps = new ArrayList<>();
-    indices = new ArrayList<>();
     rowCount = 0;
     seqRowCount = 0;
     maxTime = Long.MIN_VALUE;
@@ -119,16 +118,22 @@ public abstract class TVList implements WALEntryValue {
     return null;
   }
 
+  // get array memory cost of working TVList
+  public long tvListArrayMemCost() {
+    long size = tvListArrayMemCost(getDataType());
+    // index array mem size
+    size += indices != null ? PrimitiveArrayManager.ARRAY_SIZE * 4L : 0;
+    // bimap array mem size
+    size += bitMap != null ? PrimitiveArrayManager.ARRAY_SIZE / 8 + 1L : 0;
+    return size;
+  }
+
   public static long tvListArrayMemCost(TSDataType type) {
     long size = 0;
     // time array mem size
     size += PrimitiveArrayManager.ARRAY_SIZE * 8L;
     // value array mem size
     size += PrimitiveArrayManager.ARRAY_SIZE * (long) type.getDataTypeSize();
-    // index array mem size
-    size += PrimitiveArrayManager.ARRAY_SIZE * 4L;
-    // bimap array mem size
-    size += PrimitiveArrayManager.ARRAY_SIZE / 8 + 1L;
     // two array headers mem size
     size += NUM_BYTES_ARRAY_HEADER * 2L;
     // Object references size in ArrayList
@@ -137,7 +142,7 @@ public abstract class TVList implements WALEntryValue {
   }
 
   public long calculateRamSize() {
-    return timestamps.size() * tvListArrayMemCost(getDataType());
+    return timestamps.size() * tvListArrayMemCost();
   }
 
   public synchronized boolean isSorted() {
@@ -197,6 +202,15 @@ public abstract class TVList implements WALEntryValue {
     int arrayIndex = index / ARRAY_SIZE;
     int elementIndex = index % ARRAY_SIZE;
     timestamps.get(arrayIndex)[elementIndex] = timestamp;
+    // prepare indices for sorting
+    if (indices == null) {
+      indices = new ArrayList<>();
+      for (int i = 0; i < timestamps.size(); i++) {
+        indices.add((int[]) getPrimitiveArraysByType(TSDataType.INT32));
+        int offset = i * ARRAY_SIZE;
+        Arrays.setAll(indices.get(i), j -> offset + j);
+      }
+    }
     indices.get(arrayIndex)[elementIndex] = valueIndex;
   }
 
@@ -213,6 +227,10 @@ public abstract class TVList implements WALEntryValue {
     if (index >= rowCount) {
       throw new ArrayIndexOutOfBoundsException(index);
     }
+    if (indices == null) {
+      return index;
+    }
+
     int arrayIndex = index / ARRAY_SIZE;
     int elementIndex = index % ARRAY_SIZE;
     return indices.get(arrayIndex)[elementIndex];
@@ -374,12 +392,6 @@ public abstract class TVList implements WALEntryValue {
     return clone();
   }
 
-  protected abstract void releaseLastValueArray();
-
-  protected void releaseLastTimeArray() {
-    PrimitiveArrayManager.release(timestamps.remove(timestamps.size() - 1));
-  }
-
   public int delete(long lowerBound, long upperBound) {
     int deletedNumber = 0;
     long maxTime = Long.MIN_VALUE;
@@ -409,8 +421,11 @@ public abstract class TVList implements WALEntryValue {
       cloneList.timestamps.add(cloneTime(timestampArray));
     }
     // clone indices
-    for (int[] indicesArray : indices) {
-      cloneList.indices.add(cloneIndex(indicesArray));
+    if (indices != null) {
+      cloneList.indices = new ArrayList<>();
+      for (int[] indicesArray : indices) {
+        cloneList.indices.add(cloneIndex(indicesArray));
+      }
     }
     cloneList.rowCount = rowCount;
     cloneList.seqRowCount = seqRowCount;
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 2c85fc2aeb3..3fbc9393735 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
@@ -686,21 +686,21 @@ public class TsFileProcessorTest {
         true,
         new long[5]);
     IMemTable memTable = processor.getWorkMemTable();
-    Assert.assertEquals(1623808, memTable.getTVListsRamCost());
+    Assert.assertEquals(1623552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(100, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(1623808, memTable.getTVListsRamCost());
+    Assert.assertEquals(1623552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(200, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(1623808, memTable.getTVListsRamCost());
+    Assert.assertEquals(1623552, memTable.getTVListsRamCost());
     Assert.assertEquals(90000, memTable.getTotalPointsNum());
     Assert.assertEquals(720360, memTable.memSize());
     // Test records
@@ -709,7 +709,7 @@ public class TsFileProcessorTest {
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, 
String.valueOf(i)));
       processor.insert(buildInsertRowNodeByTSRecord(record), new long[5]);
     }
-    Assert.assertEquals(1625954, memTable.getTVListsRamCost());
+    Assert.assertEquals(1625168, memTable.getTVListsRamCost());
     Assert.assertEquals(90100, memTable.getTotalPointsNum());
     Assert.assertEquals(721560, memTable.memSize());
   }
@@ -737,56 +737,56 @@ public class TsFileProcessorTest {
         true,
         new long[5]);
     IMemTable memTable = processor.getWorkMemTable();
-    Assert.assertEquals(1623808, memTable.getTVListsRamCost());
+    Assert.assertEquals(1623552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNodeFors3000ToS6000(0, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3246808, memTable.getTVListsRamCost());
+    Assert.assertEquals(3246552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(100, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3246808, memTable.getTVListsRamCost());
+    Assert.assertEquals(3246552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNodeFors3000ToS6000(100, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3246808, memTable.getTVListsRamCost());
+    Assert.assertEquals(3246552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(200, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3246808, memTable.getTVListsRamCost());
+    Assert.assertEquals(3246552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNodeFors3000ToS6000(200, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3246808, memTable.getTVListsRamCost());
+    Assert.assertEquals(3246552, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(300, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(6493616, memTable.getTVListsRamCost());
+    Assert.assertEquals(6493104, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNodeFors3000ToS6000(300, true),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(6493616, memTable.getTVListsRamCost());
+    Assert.assertEquals(6493104, memTable.getTVListsRamCost());
 
     Assert.assertEquals(240000, memTable.getTotalPointsNum());
     Assert.assertEquals(1920960, memTable.memSize());
@@ -796,14 +796,14 @@ public class TsFileProcessorTest {
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, 
String.valueOf(i)));
       processor.insert(buildInsertRowNodeByTSRecord(record), new long[5]);
     }
-    Assert.assertEquals(6495762, memTable.getTVListsRamCost());
+    Assert.assertEquals(6494720, memTable.getTVListsRamCost());
     // Test records
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(deviceId, i);
       record.addTuple(DataPoint.getDataPoint(dataType, "s1", 
String.valueOf(i)));
       processor.insert(buildInsertRowNodeByTSRecord(record), new long[5]);
     }
-    Assert.assertEquals(6497908, memTable.getTVListsRamCost());
+    Assert.assertEquals(6496336, memTable.getTVListsRamCost());
     Assert.assertEquals(240200, memTable.getTotalPointsNum());
     Assert.assertEquals(1923360, memTable.memSize());
   }
@@ -831,21 +831,21 @@ public class TsFileProcessorTest {
         true,
         new long[5]);
     IMemTable memTable = processor.getWorkMemTable();
-    Assert.assertEquals(3987000, memTable.getTVListsRamCost());
+    Assert.assertEquals(3192000, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(100, false),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3987000, memTable.getTVListsRamCost());
+    Assert.assertEquals(3192000, memTable.getTVListsRamCost());
     processor.insertTablet(
         genInsertTableNode(200, false),
         Collections.singletonList(new int[] {0, 10}),
         new TSStatus[10],
         true,
         new long[5]);
-    Assert.assertEquals(3987000, memTable.getTVListsRamCost());
+    Assert.assertEquals(3192000, memTable.getTVListsRamCost());
     Assert.assertEquals(90000, memTable.getTotalPointsNum());
     Assert.assertEquals(1440000, memTable.memSize());
     // Test records
@@ -854,7 +854,7 @@ public class TsFileProcessorTest {
       record.addTuple(DataPoint.getDataPoint(dataType, measurementId, 
String.valueOf(i)));
       processor.insert(buildInsertRowNodeByTSRecord(record), new long[5]);
     }
-    Assert.assertEquals(3989146, memTable.getTVListsRamCost());
+    Assert.assertEquals(3193616, memTable.getTVListsRamCost());
     Assert.assertEquals(90100, memTable.getTotalPointsNum());
     Assert.assertEquals(1441200, memTable.memSize());
   }


Reply via email to