You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2019/06/26 13:16:10 UTC

[incubator-iotdb] branch feature_async_close_tsfile created (now ca93425)

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

qiaojialin pushed a change to branch feature_async_close_tsfile
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at ca93425  reuse PrimitiveArrayListV2

This branch includes the following new commits:

     new ca93425  reuse PrimitiveArrayListV2

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.



[incubator-iotdb] 01/01: reuse PrimitiveArrayListV2

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

qiaojialin pushed a commit to branch feature_async_close_tsfile
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit ca93425f40e3e3352d629d5d0be5c1eca71c76ac
Author: qiaojialin <64...@qq.com>
AuthorDate: Wed Jun 26 21:13:58 2019 +0800

    reuse PrimitiveArrayListV2
---
 .../apache/iotdb/db/engine/memtable/WritableMemChunk.java   |  8 --------
 .../org/apache/iotdb/db/utils/PrimitiveArrayListV2.java     | 13 +++----------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/WritableMemChunk.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/WritableMemChunk.java
index a6754e9..83ec8bd 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/WritableMemChunk.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/WritableMemChunk.java
@@ -19,7 +19,6 @@
 package org.apache.iotdb.db.engine.memtable;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -39,7 +38,6 @@ public class WritableMemChunk implements IWritableMemChunk {
 
   public WritableMemChunk(TSDataType dataType) {
     this.dataType = dataType;
-//    this.list = PrimitiveDataListPool.getInstance().getPrimitiveDataListByDataType(dataType);
     this.list = getPrimitiveDataListByDataType(dataType);
   }
 
@@ -173,11 +171,6 @@ public class WritableMemChunk implements IWritableMemChunk {
     return new DeduplicatedSortedData(data);
   }
 
-//  @Override
-//  public void reset() {
-//    this.list = PrimitiveDataListPool.getInstance().getPrimitiveDataListByDataType(dataType);
-//  }
-
   @Override
   public long count() {
     return list.getTotalDataNumber();
@@ -198,5 +191,4 @@ public class WritableMemChunk implements IWritableMemChunk {
     PrimitiveDataListPool.getInstance().release(list);
   }
 
-
 }
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/utils/PrimitiveArrayListV2.java b/iotdb/src/main/java/org/apache/iotdb/db/utils/PrimitiveArrayListV2.java
index 88592c6..2863db4 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/utils/PrimitiveArrayListV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/utils/PrimitiveArrayListV2.java
@@ -21,8 +21,6 @@ package org.apache.iotdb.db.utils;
 import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.iotdb.db.monitor.collector.MemTableWriteTimeCost;
-import org.apache.iotdb.db.monitor.collector.MemTableWriteTimeCost.MemTableWriteTimeCostType;
 
 public class PrimitiveArrayListV2 {
 
@@ -54,21 +52,16 @@ public class PrimitiveArrayListV2 {
   private void checkCapacity(int aimSize) {
     if (currentArraySize < aimSize) {
       if (currentArraySize < MAX_SIZE_OF_ONE_ARRAY) {
-//        long start = System.currentTimeMillis();
-        // expand current Array
         int newCapacity = Math.min(MAX_SIZE_OF_ONE_ARRAY, currentArraySize * 2);
         values.set(currentArrayIndex,
             expandArray(values.get(currentArrayIndex), currentArraySize, newCapacity));
         timestamps.set(currentArrayIndex,
             (long[]) expandArray(timestamps.get(currentArrayIndex), currentArraySize, newCapacity));
         currentArraySize = newCapacity;
-//        MemTableWriteTimeCost.getInstance().measure(MemTableWriteTimeCostType.CAPACITY_1, start);
       } else {
-//        if (currentArrayIndex == values.size() - 1) {
-          // add a new Array to the list
-          values.add(Array.newInstance(clazz, INITIAL_SIZE));
-          timestamps.add(new long[INITIAL_SIZE]);
-//        }
+        // add a new Array to the list
+        values.add(Array.newInstance(clazz, INITIAL_SIZE));
+        timestamps.add(new long[INITIAL_SIZE]);
         currentArrayIndex++;
         currentArraySize = timestamps.get(currentArrayIndex).length;
         offsetInCurrentArray = -1;