You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by lt...@apache.org on 2019/06/19 15:50:09 UTC

[incubator-iotdb] 01/03: fix some issues and add apache rat

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

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

commit 157d720e91a244538deadddfcc151e98bce3c2a6
Author: lta <li...@163.com>
AuthorDate: Wed Jun 19 20:23:23 2019 +0800

    fix some issues and add apache rat
---
 .../iotdb/db/engine/UnsealedTsFileProcessorV2.java | 47 +++++++++++++++-------
 .../db/engine/bufferwriteV2/FlushManager.java      | 14 +++----
 .../db/engine/filenodeV2/FileNodeManagerV2.java    |  7 ++--
 .../filenodeV2/FileNodeProcessorStoreV2.java       | 31 ++++++++++----
 .../db/engine/filenodeV2/FileNodeProcessorV2.java  | 22 +++++-----
 .../iotdb/db/engine/filenodeV2/MetadataAgent.java  |  1 +
 .../apache/iotdb/db/engine/memtable/Callback.java  | 18 +++++++++
 .../db/engine/memtable/MemTableFlushCallBack.java  | 18 +++++++++
 .../GlobalSortedSeriesDataSourceV2.java            |  1 -
 .../db/engine/querycontext/SealedTsFileV2.java     | 18 +++++++++
 .../db/engine/querycontext/UnsealedTsFileV2.java   | 11 +++--
 .../monitor/collector/MemTableWriteTimeCost.java   | 18 +++++++++
 12 files changed, 161 insertions(+), 45 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/UnsealedTsFileProcessorV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/UnsealedTsFileProcessorV2.java
index fba95a0..a56d29e 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/UnsealedTsFileProcessorV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/UnsealedTsFileProcessorV2.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.iotdb.db.engine;
 
 import java.io.File;
@@ -38,36 +56,39 @@ public class UnsealedTsFileProcessorV2 {
 
   protected FileSchema fileSchema;
 
-  protected final String storageGroupName;
+  private final String storageGroupName;
 
   protected TsFileResourceV2 tsFileResource;
 
-  protected volatile boolean managedByFlushManager;
+  private volatile boolean managedByFlushManager;
 
-  protected ReadWriteLock flushQueryLock = new ReentrantReadWriteLock();
+  private ReadWriteLock flushQueryLock = new ReentrantReadWriteLock();
 
   /**
-   * true: to be closed
+   * true: should be closed
    */
-  protected volatile boolean shouldClose;
+  private volatile boolean shouldClose;
 
-  protected IMemTable workMemTable;
+  private IMemTable workMemTable;
 
   protected VersionController versionController;
 
-  protected Callback closeBufferWriteProcessor;
+  private Callback closeUnsealedTsFileProcessor;
 
-  // synch this object in query() and asyncFlush()
-  protected final LinkedList<IMemTable> flushingMemTables = new LinkedList<>();
+  /**
+   * sync this object in query() and asyncFlush()
+   */
+  private final LinkedList<IMemTable> flushingMemTables = new LinkedList<>();
 
   public UnsealedTsFileProcessorV2(String storageGroupName, File file, FileSchema fileSchema,
-      VersionController versionController, Callback closeBufferWriteProcessor) throws IOException {
+      VersionController versionController, Callback closeUnsealedTsFileProcessor)
+      throws IOException {
     this.storageGroupName = storageGroupName;
     this.fileSchema = fileSchema;
     this.tsFileResource = new UnsealedTsFileV2(file);
     this.versionController = versionController;
     this.writer = new NativeRestorableIOWriter(file);
-    this.closeBufferWriteProcessor = closeBufferWriteProcessor;
+    this.closeUnsealedTsFileProcessor = closeUnsealedTsFileProcessor;
   }
 
   /**
@@ -91,8 +112,6 @@ public class UnsealedTsFileProcessorV2 {
 
     // TODO write WAL
 
-
-
     // update start time of this memtable
     tsFileResource.updateStartTime(tsRecord.deviceId, tsRecord.time);
 
@@ -158,7 +177,7 @@ public class UnsealedTsFileProcessorV2 {
     writer = null;
 
     // remove this processor from Closing list in FileNodeProcessor
-    closeBufferWriteProcessor.call(this);
+    closeUnsealedTsFileProcessor.call(this);
 
     // delete the restore for this bufferwrite processor
     if (LOGGER.isInfoEnabled()) {
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwriteV2/FlushManager.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwriteV2/FlushManager.java
index 1398a9d..c9d3011 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwriteV2/FlushManager.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwriteV2/FlushManager.java
@@ -25,12 +25,12 @@ import org.apache.iotdb.db.engine.pool.FlushPoolManager;
 
 public class FlushManager {
 
-  private ConcurrentLinkedQueue<UnsealedTsFileProcessorV2> udfProcessorQueue = new ConcurrentLinkedQueue<>();
+  private ConcurrentLinkedQueue<UnsealedTsFileProcessorV2> unsealedTsFileProcessorQueue = new ConcurrentLinkedQueue<>();
 
   private FlushPoolManager flushPool = FlushPoolManager.getInstance();
 
   private Runnable flushThread = () -> {
-    UnsealedTsFileProcessorV2 udfProcessor = udfProcessorQueue.poll();
+    UnsealedTsFileProcessorV2 udfProcessor = unsealedTsFileProcessorQueue.poll();
     try {
       udfProcessor.flushOneMemTable();
     } catch (IOException e) {
@@ -43,11 +43,11 @@ public class FlushManager {
   /**
    * Add BufferWriteProcessor to asyncFlush manager
    */
-  public boolean registerBWProcessor(UnsealedTsFileProcessorV2 udfProcessor) {
-    synchronized (udfProcessor) {
-      if (!udfProcessor.isManagedByFlushManager() && udfProcessor.getFlushingMemTableSize() > 0) {
-        udfProcessorQueue.add(udfProcessor);
-        udfProcessor.setManagedByFlushManager(true);
+  public boolean registerBWProcessor(UnsealedTsFileProcessorV2 unsealedTsFileProcessor) {
+    synchronized (unsealedTsFileProcessor) {
+      if (!unsealedTsFileProcessor.isManagedByFlushManager() && unsealedTsFileProcessor.getFlushingMemTableSize() > 0) {
+        unsealedTsFileProcessorQueue.add(unsealedTsFileProcessor);
+        unsealedTsFileProcessor.setManagedByFlushManager(true);
         flushPool.submit(flushThread);
         return true;
       }
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeManagerV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeManagerV2.java
index 1e183b3..a42d4d4 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeManagerV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeManagerV2.java
@@ -43,8 +43,8 @@ public class FileNodeManagerV2 implements IService {
   private static final Directories directories = Directories.getInstance();
 
   /**
-   * a folder (system/info/ by default) that persist FileNodeProcessorStore classes. Ends with File.separator
-   * Each FileNodeManager will have a subfolder.
+   * a folder (system/info/ by default) that persist FileNodeProcessorStore classes. Ends with
+   * File.separator Each FileNodeManager will have a subfolder.
    */
   private final String baseDir;
 
@@ -142,7 +142,8 @@ public class FileNodeManagerV2 implements IService {
     try {
       fileNodeProcessor = getProcessor(tsRecord.deviceId);
     } catch (Exception e) {
-      LOGGER.warn("get FileNodeProcessor of device {} failed, because {}", tsRecord.deviceId, e.getMessage(), e);
+      LOGGER.warn("get FileNodeProcessor of device {} failed, because {}", tsRecord.deviceId,
+          e.getMessage(), e);
       return false;
     }
 
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorStoreV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorStoreV2.java
index b136511..d13868d 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorStoreV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorStoreV2.java
@@ -36,8 +36,8 @@ import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
  * lastUpdateTime is changed and stored by BufferWrite flushMetadata or BufferWrite close.
  * emptyTsFileResource and sequenceFileList are changed and stored by Overflow flushMetadata and
  * Overflow close. fileNodeProcessorState is changed and stored by the change of FileNodeProcessor's
- * status such as "work->merge merge->wait wait->work". numOfMergeFile is changed
- * and stored when FileNodeProcessor's status changes from work to merge.
+ * status such as "work->merge merge->wait wait->work". numOfMergeFile is changed and stored when
+ * FileNodeProcessor's status changes from work to merge.
  */
 public class FileNodeProcessorStoreV2 implements Serializable {
 
@@ -55,16 +55,19 @@ public class FileNodeProcessorStoreV2 implements Serializable {
    *
    * @param isOverflowed whether this FileNode contains unmerged Overflow operations.
    * @param latestTimeMap the timestamp of last data point of each device in this FileNode.
-   * @param sequenceFileList TsFiles in the FileNode.
+   * @param sequenceFileList sequnce tsfiles in the FileNode.
+   * @param unSequenceFileList unsequnce tsfiles in the FileNode
    * @param fileNodeProcessorStatus the status of the FileNode.
    * @param numOfMergeFile the number of files already merged in one merge operation.
    */
   public FileNodeProcessorStoreV2(boolean isOverflowed, Map<String, Long> latestTimeMap,
-      List<TsFileResourceV2> sequenceFileList, FileNodeProcessorStatus fileNodeProcessorStatus,
+      List<TsFileResourceV2> sequenceFileList, List<TsFileResourceV2> unSequenceFileList,
+      FileNodeProcessorStatus fileNodeProcessorStatus,
       int numOfMergeFile) {
     this.isOverflowed = isOverflowed;
     this.latestTimeMap = latestTimeMap;
     this.sequenceFileList = sequenceFileList;
+    this.unSequenceFileList = unSequenceFileList;
     this.fileNodeProcessorStatus = fileNodeProcessorStatus;
     this.numOfMergeFile = numOfMergeFile;
   }
@@ -82,6 +85,10 @@ public class FileNodeProcessorStoreV2 implements Serializable {
     for (TsFileResourceV2 tsFileResource : this.sequenceFileList) {
       tsFileResource.serialize(byteArrayOutputStream);
     }
+    ReadWriteIOUtils.write(this.unSequenceFileList.size(), byteArrayOutputStream);
+    for (TsFileResourceV2 tsFileResource : this.unSequenceFileList) {
+      tsFileResource.serialize(byteArrayOutputStream);
+    }
     ReadWriteIOUtils.write(this.numOfMergeFile, byteArrayOutputStream);
     ReadWriteIOUtils.write(this.fileNodeProcessorStatus.serialize(), byteArrayOutputStream);
     // buffer array to outputstream
@@ -98,16 +105,21 @@ public class FileNodeProcessorStoreV2 implements Serializable {
       lastUpdateTimeMap.put(path, time);
     }
     size = ReadWriteIOUtils.readInt(inputStream);
-    List<TsFileResourceV2> newFileNodes = new ArrayList<>();
+    List<TsFileResourceV2> sequenceFileList = new ArrayList<>();
     for (int i = 0; i < size; i++) {
-      newFileNodes.add(TsFileResourceV2.deSerialize(inputStream));
+      sequenceFileList.add(TsFileResourceV2.deSerialize(inputStream));
+    }
+    size = ReadWriteIOUtils.readInt(inputStream);
+    List<TsFileResourceV2> unsequenceFileList = new ArrayList<>();
+    for (int i = 0; i < size; i++) {
+      unsequenceFileList.add(TsFileResourceV2.deSerialize(inputStream));
     }
     int numOfMergeFile = ReadWriteIOUtils.readInt(inputStream);
     FileNodeProcessorStatus fileNodeProcessorStatus = FileNodeProcessorStatus
         .deserialize(ReadWriteIOUtils.readShort(inputStream));
 
     return new FileNodeProcessorStoreV2(isOverflowed, lastUpdateTimeMap,
-        newFileNodes, fileNodeProcessorStatus, numOfMergeFile);
+        sequenceFileList, unsequenceFileList, fileNodeProcessorStatus, numOfMergeFile);
   }
 
   public boolean isOverflowed() {
@@ -153,4 +165,9 @@ public class FileNodeProcessorStoreV2 implements Serializable {
   public void setNumOfMergeFile(int numOfMergeFile) {
     this.numOfMergeFile = numOfMergeFile;
   }
+
+  public void setUnSequenceFileList(
+      List<TsFileResourceV2> unSequenceFileList) {
+    this.unSequenceFileList = unSequenceFileList;
+  }
 }
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java
index 7d823f5..4aa8ed7 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/FileNodeProcessorV2.java
@@ -185,7 +185,7 @@ public class FileNodeProcessorV2 {
       File restoreFile = new File(fileNodeRestoreFilePath);
       if (!restoreFile.exists() || restoreFile.length() == 0) {
         return new FileNodeProcessorStoreV2(false, new HashMap<>(),
-            new ArrayList<>(), FileNodeProcessorStatus.NONE, 0);
+            new ArrayList<>(), new ArrayList<>(), FileNodeProcessorStatus.NONE, 0);
       }
       try (FileInputStream inputStream = new FileInputStream(fileNodeRestoreFilePath)) {
         return FileNodeProcessorStoreV2.deSerialize(inputStream);
@@ -247,14 +247,14 @@ public class FileNodeProcessorV2 {
         String baseDir = directories.getNextFolderForTsfile();
         String filePath = Paths.get(baseDir, storageGroup, tsRecord.time + "").toString();
         unsealedTsFileProcessor = new UnsealedTsFileProcessorV2(storageGroup, new File(filePath),
-            fileSchema, versionController, this::closeBufferWriteProcessorCallBack);
+            fileSchema, versionController, this::closeUnsealedTsFileProcessorCallBack);
         sequenceFileList.add(unsealedTsFileProcessor.getTsFileResource());
       } else {
         // TODO check if the disk is full
         String baseDir = IoTDBDescriptor.getInstance().getConfig().getOverflowDataDir();
         String filePath = Paths.get(baseDir, storageGroup, tsRecord.time + "").toString();
         unsealedTsFileProcessor = new UnsealedTsFileProcessorV2(storageGroup, new File(filePath),
-            fileSchema, versionController, this::closeBufferWriteProcessorCallBack);
+            fileSchema, versionController, this::closeUnsealedTsFileProcessorCallBack);
         unSequenceFileList.add(unsealedTsFileProcessor.getTsFileResource());
       }
     }
@@ -278,21 +278,24 @@ public class FileNodeProcessorV2 {
 
   public QueryDataSourceV2 query(String deviceId, String measurementId) {
 
-    List<TsFileResourceV2> sequnceResources = getFileReSourceListForQuery(sequenceFileList, deviceId, measurementId);
-    List<TsFileResourceV2> unsequnceResources = getFileReSourceListForQuery(unSequenceFileList, deviceId, measurementId);
+    List<TsFileResourceV2> sequnceResources = getFileReSourceListForQuery(sequenceFileList,
+        deviceId, measurementId);
+    List<TsFileResourceV2> unsequnceResources = getFileReSourceListForQuery(unSequenceFileList,
+        deviceId, measurementId);
 
-    return new QueryDataSourceV2(new GlobalSortedSeriesDataSourceV2(new Path(deviceId, measurementId), sequnceResources),
+    return new QueryDataSourceV2(
+        new GlobalSortedSeriesDataSourceV2(new Path(deviceId, measurementId), sequnceResources),
         new GlobalSortedSeriesDataSourceV2(new Path(deviceId, measurementId), unsequnceResources));
 
   }
 
 
   /**
-   *
    * @param tsFileResources includes sealed and unsealed tsfile resources
    * @return fill unsealed tsfile resources with memory data and ChunkMetadataList of data in disk
    */
-  private List<TsFileResourceV2> getFileReSourceListForQuery(List<TsFileResourceV2> tsFileResources, String deviceId, String measurementId) {
+  private List<TsFileResourceV2> getFileReSourceListForQuery(List<TsFileResourceV2> tsFileResources,
+      String deviceId, String measurementId) {
 
     MeasurementSchema mSchema = fileSchema.getMeasurementSchema(measurementId);
     TSDataType dataType = mSchema.getType();
@@ -317,7 +320,6 @@ public class FileNodeProcessorV2 {
   }
 
 
-
   /**
    * ensure there must be a flush thread submitted after close() is called, therefore the close task
    * will be executed by a flush thread. -- said by qiaojialin
@@ -358,7 +360,7 @@ public class FileNodeProcessorV2 {
   /**
    * return the memtable to MemTablePool and make metadata in writer visible
    */
-  private void closeBufferWriteProcessorCallBack(Object bufferWriteProcessor) {
+  private void closeUnsealedTsFileProcessorCallBack(Object bufferWriteProcessor) {
     closingBufferWriteProcessor.remove((UnsealedTsFileProcessorV2) bufferWriteProcessor);
     synchronized (fileNodeProcessorStore) {
       fileNodeProcessorStore.setLatestTimeMap(latestTimeMap);
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/MetadataAgent.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/MetadataAgent.java
index 7c725f1..7fcd956 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/MetadataAgent.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenodeV2/MetadataAgent.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.tsfile.read.common.Path;
 import org.apache.iotdb.tsfile.utils.Pair;
 import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
 
+@Deprecated
 public class MetadataAgent {
 
 
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/Callback.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/Callback.java
index 6359574..6e23d1e 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/Callback.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/Callback.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.iotdb.db.engine.memtable;
 
 public interface Callback {
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/MemTableFlushCallBack.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/MemTableFlushCallBack.java
index d5e2ae5..ac24a07 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/MemTableFlushCallBack.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/memtable/MemTableFlushCallBack.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.iotdb.db.engine.memtable;
 
 import org.apache.iotdb.tsfile.write.writer.TsFileIOWriter;
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/GlobalSortedSeriesDataSourceV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/GlobalSortedSeriesDataSourceV2.java
index cdda07c..a5b5bfe 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/GlobalSortedSeriesDataSourceV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/GlobalSortedSeriesDataSourceV2.java
@@ -19,7 +19,6 @@
 package org.apache.iotdb.db.engine.querycontext;
 
 import java.util.List;
-import org.apache.iotdb.db.engine.filenode.TsFileResource;
 import org.apache.iotdb.db.engine.filenodeV2.TsFileResourceV2;
 import org.apache.iotdb.tsfile.read.common.Path;
 
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/SealedTsFileV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/SealedTsFileV2.java
index 34ffd59..585d858 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/SealedTsFileV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/SealedTsFileV2.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.iotdb.db.engine.querycontext;
 
 import java.io.File;
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/UnsealedTsFileV2.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/UnsealedTsFileV2.java
index a1f8e9d..15bb92d 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/UnsealedTsFileV2.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/querycontext/UnsealedTsFileV2.java
@@ -26,9 +26,14 @@ import org.apache.iotdb.tsfile.file.metadata.ChunkMetaData;
 
 public class UnsealedTsFileV2 extends TsFileResourceV2 {
 
+  /**
+   * Chunk metadata list of unsealed tsfile
+   */
   private List<ChunkMetaData> timeSeriesChunkMetaDatas;
 
-  // seq mem-table
+  /**
+   * Mem chunk data
+   */
   private ReadOnlyMemChunk readableChunk;
 
   public UnsealedTsFileV2(File file) {
@@ -56,7 +61,7 @@ public class UnsealedTsFileV2 extends TsFileResourceV2 {
     return timeSeriesChunkMetaDatas;
   }
 
-  public void setTimeSeriesChunkMetaDatas(List<ChunkMetaData> timeSeriesChunkMetaDatas) {
-    this.timeSeriesChunkMetaDatas = timeSeriesChunkMetaDatas;
+  public ReadOnlyMemChunk getReadableChunk() {
+    return readableChunk;
   }
 }
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/monitor/collector/MemTableWriteTimeCost.java b/iotdb/src/main/java/org/apache/iotdb/db/monitor/collector/MemTableWriteTimeCost.java
index ccf3f57..86696cd 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/monitor/collector/MemTableWriteTimeCost.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/monitor/collector/MemTableWriteTimeCost.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.iotdb.db.monitor.collector;
 
 import java.util.Map;