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 2021/03/01 11:08:52 UTC

[iotdb] branch rel/0.11 updated: fix 0.11 compile (#2751)

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

qiaojialin pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.11 by this push:
     new da86fd4  fix 0.11 compile (#2751)
da86fd4 is described below

commit da86fd47e8738772cd632315e8af7342d5a595d6
Author: zhanglingzhe0820 <44...@qq.com>
AuthorDate: Mon Mar 1 19:08:31 2021 +0800

    fix 0.11 compile (#2751)
    
    Co-authored-by: zhanglingzhe <su...@foxmail.com>
---
 .../level/LevelCompactionTsFileManagement.java     |  46 ++---
 .../db/engine/storagegroup/TsFileResource.java     | 122 +++++--------
 .../engine/merge/MaxFileMergeFileSelectorTest.java | 198 ---------------------
 3 files changed, 70 insertions(+), 296 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java
index 0f4d3e5..fbc7ef4 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java
@@ -19,6 +19,27 @@
 
 package org.apache.iotdb.db.engine.compaction.level;
 
+import static org.apache.iotdb.db.conf.IoTDBConstant.FILE_NAME_SEPARATOR;
+import static org.apache.iotdb.db.engine.compaction.utils.CompactionLogger.COMPACTION_LOG_NAME;
+import static org.apache.iotdb.db.engine.compaction.utils.CompactionLogger.SOURCE_NAME;
+import static org.apache.iotdb.db.engine.compaction.utils.CompactionLogger.TARGET_NAME;
+import static org.apache.iotdb.tsfile.common.constant.TsFileConstant.TSFILE_SUFFIX;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.engine.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.ChunkMetadataCache;
@@ -35,32 +56,9 @@ import org.apache.iotdb.db.query.control.FileReaderManager;
 import org.apache.iotdb.db.utils.TestOnly;
 import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
 import org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import static org.apache.iotdb.db.conf.IoTDBConstant.FILE_NAME_SEPARATOR;
-import static org.apache.iotdb.db.engine.compaction.utils.CompactionLogger.COMPACTION_LOG_NAME;
-import static org.apache.iotdb.db.engine.compaction.utils.CompactionLogger.SOURCE_NAME;
-import static org.apache.iotdb.db.engine.compaction.utils.CompactionLogger.TARGET_NAME;
-import static org.apache.iotdb.tsfile.common.constant.TsFileConstant.TSFILE_SUFFIX;
-
 /** The TsFileManagement for LEVEL_COMPACTION, use level struct to manage TsFile list */
 public class LevelCompactionTsFileManagement extends TsFileManagement {
 
@@ -78,6 +76,8 @@ public class LevelCompactionTsFileManagement extends TsFileManagement {
 
   private final boolean enableUnseqCompaction =
       IoTDBDescriptor.getInstance().getConfig().isEnableUnseqCompaction();
+  private final boolean isForceFullMerge =
+      IoTDBDescriptor.getInstance().getConfig().isForceFullMerge();
 
   // First map is partition list; Second list is level list; Third list is file list in level;
   private final Map<Long, List<SortedSet<TsFileResource>>> sequenceTsFileResources =
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index 559bd01..2cca8d7 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -63,8 +63,8 @@ import org.slf4j.LoggerFactory;
 public class TsFileResource {
 
   private static final Logger logger = LoggerFactory.getLogger(TsFileResource.class);
-  private static Map<String, String> cachedDevicePool = CachedStringPool.getInstance()
-      .getCachedPool();
+  private static Map<String, String> cachedDevicePool =
+      CachedStringPool.getInstance().getCachedPool();
 
   // tsfile
   private File file;
@@ -74,9 +74,7 @@ public class TsFileResource {
   private static final String CLOSING_SUFFIX = ".closing";
   protected static final int INIT_ARRAY_SIZE = 64;
 
-  /**
-   * start times array.
-   */
+  /** start times array. */
   protected long[] startTimes;
 
   /**
@@ -85,9 +83,7 @@ public class TsFileResource {
    */
   protected long[] endTimes;
 
-  /**
-   * device -> index of start times array and end times array
-   */
+  /** device -> index of start times array and end times array */
   protected Map<String, Integer> deviceToIndex;
 
   public TsFileProcessor getProcessor() {
@@ -120,21 +116,15 @@ public class TsFileResource {
    */
   private List<ChunkMetadata> chunkMetadataList;
 
-  /**
-   * Mem chunk data. Only be set in a temporal TsFileResource in a query process.
-   */
+  /** Mem chunk data. Only be set in a temporal TsFileResource in a query process. */
   private List<ReadOnlyMemChunk> readOnlyMemChunk;
 
-  /**
-   * used for unsealed file to get TimeseriesMetadata
-   */
+  /** used for unsealed file to get TimeseriesMetadata */
   private TimeseriesMetadata timeSeriesMetadata;
 
   private FSFactory fsFactory = FSFactoryProducer.getFSFactory();
 
-  /**
-   * generated upgraded TsFile ResourceList used for upgrading v0.9.x/v1 -> 0.10/v2
-   */
+  /** generated upgraded TsFile ResourceList used for upgrading v0.9.x/v1 -> 0.10/v2 */
   private List<TsFileResource> upgradedResources;
 
   /**
@@ -156,18 +146,13 @@ public class TsFileResource {
    */
   private TsFileResource originTsFileResource;
 
-  /**
-   * Maximum index of plans executed within this TsFile.
-   */
+  /** Maximum index of plans executed within this TsFile. */
   private long maxPlanIndex = Long.MIN_VALUE;
 
-  /**
-   * Minimum index of plans executed within this TsFile.
-   */
+  /** Minimum index of plans executed within this TsFile. */
   private long minPlanIndex = Long.MAX_VALUE;
 
-  public TsFileResource() {
-  }
+  public TsFileResource() {}
 
   public TsFileResource(TsFileResource other) throws IOException {
     this.file = other.file;
@@ -187,9 +172,7 @@ public class TsFileResource {
     this.historicalVersions = other.historicalVersions;
   }
 
-  /**
-   * for sealed TsFile, call setClosed to close TsFileResource
-   */
+  /** for sealed TsFile, call setClosed to close TsFileResource */
   public TsFileResource(File file) {
     this.file = file;
     this.deviceToIndex = new ConcurrentHashMap<>();
@@ -199,9 +182,7 @@ public class TsFileResource {
     initTimes(endTimes, Long.MIN_VALUE);
   }
 
-  /**
-   * unsealed TsFile
-   */
+  /** unsealed TsFile */
   public TsFileResource(File file, TsFileProcessor processor) {
     this.file = file;
     this.deviceToIndex = new ConcurrentHashMap<>();
@@ -212,12 +193,15 @@ public class TsFileResource {
     this.processor = processor;
   }
 
-  /**
-   * unsealed TsFile
-   */
-  public TsFileResource(File file, Map<String, Integer> deviceToIndex, long[] startTimes,
-      long[] endTimes, List<ReadOnlyMemChunk> readOnlyMemChunk,
-      List<ChunkMetadata> chunkMetadataList, TsFileResource originTsFileResource)
+  /** unsealed TsFile */
+  public TsFileResource(
+      File file,
+      Map<String, Integer> deviceToIndex,
+      long[] startTimes,
+      long[] endTimes,
+      List<ReadOnlyMemChunk> readOnlyMemChunk,
+      List<ChunkMetadata> chunkMetadataList,
+      TsFileResource originTsFileResource)
       throws IOException {
     this.file = file;
     this.deviceToIndex = deviceToIndex;
@@ -266,8 +250,8 @@ public class TsFileResource {
   }
 
   public synchronized void serialize() throws IOException {
-    try (OutputStream outputStream = fsFactory.getBufferedOutputStream(
-        file + RESOURCE_SUFFIX + TEMP_SUFFIX)) {
+    try (OutputStream outputStream =
+        fsFactory.getBufferedOutputStream(file + RESOURCE_SUFFIX + TEMP_SUFFIX)) {
       ReadWriteIOUtils.write(this.deviceToIndex.size(), outputStream);
       for (Entry<String, Integer> entry : this.deviceToIndex.entrySet()) {
         ReadWriteIOUtils.write(entry.getKey(), outputStream);
@@ -293,8 +277,7 @@ public class TsFileResource {
   }
 
   public void deserialize() throws IOException {
-    try (InputStream inputStream = fsFactory.getBufferedInputStream(
-        file + RESOURCE_SUFFIX)) {
+    try (InputStream inputStream = fsFactory.getBufferedInputStream(file + RESOURCE_SUFFIX)) {
       int size = ReadWriteIOUtils.readInt(inputStream);
       Map<String, Integer> deviceMap = new HashMap<>();
       long[] startTimesArray = new long[size];
@@ -509,7 +492,6 @@ public class TsFileResource {
     return processor;
   }
 
-
   public void writeLock() {
     if (originTsFileResource == null) {
       tsFileLock.writeLock();
@@ -565,9 +547,7 @@ public class TsFileResource {
     modFile = null;
   }
 
-  /**
-   * Remove the data file, its resource file, and its modification file physically.
-   */
+  /** Remove the data file, its resource file, and its modification file physically. */
   public void remove() {
     file.delete();
     fsFactory.getFile(file.getPath() + RESOURCE_SUFFIX).delete();
@@ -580,7 +560,8 @@ public class TsFileResource {
 
   void moveTo(File targetDir) {
     fsFactory.moveFile(file, fsFactory.getFile(targetDir, file.getName()));
-    fsFactory.moveFile(fsFactory.getFile(file.getPath() + RESOURCE_SUFFIX),
+    fsFactory.moveFile(
+        fsFactory.getFile(file.getPath() + RESOURCE_SUFFIX),
         fsFactory.getFile(targetDir, file.getName() + RESOURCE_SUFFIX));
     fsFactory.getFile(file.getPath() + ModificationFile.FILE_SUFFIX).delete();
   }
@@ -627,9 +608,7 @@ public class TsFileResource {
     isMerging = merging;
   }
 
-  /**
-   * check if any of the device lives over the given time bound
-   */
+  /** check if any of the device lives over the given time bound */
   public boolean stillLives(long timeLowerBound) {
     if (timeLowerBound == Long.MAX_VALUE) {
       return true;
@@ -665,9 +644,7 @@ public class TsFileResource {
     }
   }
 
-  /**
-   * clean the close flag (if existed) when the file is successfully closed.
-   */
+  /** clean the close flag (if existed) when the file is successfully closed. */
   public void cleanCloseFlag() {
     if (!fsFactory.getFile(file.getAbsoluteFile() + CLOSING_SUFFIX).delete()) {
       logger.error("Cannot clean close flag for {}", file);
@@ -719,9 +696,7 @@ public class TsFileResource {
     return upgradeTsFileResourceCallBack;
   }
 
-  /**
-   * make sure Either the deviceToIndex is not empty Or the path contains a partition folder
-   */
+  /** make sure Either the deviceToIndex is not empty Or the path contains a partition folder */
   public long getTimePartition() {
     try {
       if (deviceToIndex != null && !deviceToIndex.isEmpty()) {
@@ -773,7 +748,7 @@ public class TsFileResource {
    * suffix like ".{sysTime}_{randomLong}"
    *
    * @return a new TsFileResource with its file changed to the hardlink or null the hardlink cannot
-   * be created.
+   *     be created.
    */
   public TsFileResource createHardlink() {
     if (!file.exists()) {
@@ -822,17 +797,16 @@ public class TsFileResource {
     return maxVersion;
   }
 
-  /**
-   * @return initial resource map size
-   */
+  /** @return initial resource map size */
   public long calculateRamSize() {
-    return RamUsageEstimator.sizeOf(deviceToIndex) + RamUsageEstimator.sizeOf(startTimes) + 
-        RamUsageEstimator.sizeOf(endTimes);
+    return RamUsageEstimator.sizeOf(deviceToIndex)
+        + RamUsageEstimator.sizeOf(startTimes)
+        + RamUsageEstimator.sizeOf(endTimes);
   }
 
   /**
    * Calculate the resource ram increment when insert data in TsFileProcessor
-   * 
+   *
    * @return ramIncrement
    */
   public long estimateRamIncrement(String deviceToBeChecked) {
@@ -855,8 +829,10 @@ public class TsFileResource {
   public void delete() throws IOException {
     if (file.exists()) {
       Files.delete(file.toPath());
-      Files.delete(FSFactoryProducer.getFSFactory()
-          .getFile(file.toPath() + TsFileResource.RESOURCE_SUFFIX).toPath());
+      Files.delete(
+          FSFactoryProducer.getFSFactory()
+              .getFile(file.toPath() + TsFileResource.RESOURCE_SUFFIX)
+              .toPath());
     }
   }
 
@@ -875,26 +851,22 @@ public class TsFileResource {
       try {
         serialize();
       } catch (IOException e) {
-        logger.error("Cannot serialize TsFileResource {} when updating plan index {}-{}", this,
-            maxPlanIndex, planIndex);
+        logger.error(
+            "Cannot serialize TsFileResource {} when updating plan index {}-{}",
+            this,
+            maxPlanIndex,
+            planIndex);
       }
     }
   }
 
-  /**
-   * For merge, the index range of the new file should be the union of all files' in this merge.
-   */
+  /** For merge, the index range of the new file should be the union of all files' in this merge. */
   public void updatePlanIndexes(TsFileResource another) {
     maxPlanIndex = Math.max(maxPlanIndex, another.maxPlanIndex);
     minPlanIndex = Math.min(minPlanIndex, another.minPlanIndex);
   }
 
   public boolean isPlanIndexOverlap(TsFileResource another) {
-    return another.maxPlanIndex >= this.minPlanIndex &&
-           another.minPlanIndex <= this.maxPlanIndex;
-  }
-
-  public void setTimeIndex(ITimeIndex timeIndex) {
-    this.timeIndex = timeIndex;
+    return another.maxPlanIndex >= this.minPlanIndex && another.minPlanIndex <= this.maxPlanIndex;
   }
 }
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxFileMergeFileSelectorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxFileMergeFileSelectorTest.java
deleted file mode 100644
index 7275a01..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxFileMergeFileSelectorTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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.merge;
-
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.selector.IMergeFileSelector;
-import org.apache.iotdb.db.engine.merge.selector.MaxFileMergeFileSelector;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.engine.storagegroup.timeindex.ITimeIndex;
-import org.apache.iotdb.db.exception.MergeException;
-import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-
-import org.junit.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.List;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-
-public class MaxFileMergeFileSelectorTest extends MergeTest {
-
-  @Test
-  public void testFullSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources, seqSelected);
-    assertEquals(unseqResources, unseqSelected);
-    resource.clear();
-
-    resource = new MergeResource(seqResources.subList(0, 1), unseqResources);
-    mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    result = mergeFileSelector.select();
-    seqSelected = result[0];
-    unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources, unseqSelected);
-    resource.clear();
-
-    resource = new MergeResource(seqResources, unseqResources.subList(0, 1));
-    mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    result = mergeFileSelector.select();
-    seqSelected = result[0];
-    unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources.subList(0, 1), unseqSelected);
-    resource.clear();
-  }
-
-  @Test
-  public void testNonSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, 1);
-    List[] result = mergeFileSelector.select();
-    assertEquals(0, result.length);
-    resource.clear();
-  }
-
-  @Test
-  public void testRestrictedSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, 400000);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 4), seqSelected);
-    assertEquals(unseqResources.subList(0, 4), unseqSelected);
-    resource.clear();
-  }
-
-  /**
-   * test unseq merge select with the following files: {0seq-0-0-0.tsfile 0-100 1seq-1-1-0.tsfile
-   * 100-200 2seq-2-2-0.tsfile 200-300 3seq-3-3-0.tsfile 300-400 4seq-4-4-0.tsfile 400-500}
-   * {10unseq-10-10-0.tsfile 0-500}
-   */
-  @Test
-  public void testFileOpenSelection()
-      throws MergeException, IOException, WriteProcessException, NoSuchFieldException,
-          IllegalAccessException {
-    File file =
-        new File(
-            TestConstant.BASE_OUTPUT_PATH.concat(
-                10
-                    + "unseq"
-                    + IoTDBConstant.FILE_NAME_SEPARATOR
-                    + 10
-                    + IoTDBConstant.FILE_NAME_SEPARATOR
-                    + 10
-                    + IoTDBConstant.FILE_NAME_SEPARATOR
-                    + 0
-                    + ".tsfile"));
-    TsFileResource largeUnseqTsFileResource = new TsFileResource(file);
-    largeUnseqTsFileResource.setClosed(true);
-    largeUnseqTsFileResource.setMinPlanIndex(10);
-    largeUnseqTsFileResource.setMaxPlanIndex(10);
-    largeUnseqTsFileResource.setVersion(10);
-    prepareFile(largeUnseqTsFileResource, 0, seqFileNum * ptNum, 0);
-
-    // update the second file's status to open
-    TsFileResource secondTsFileResource = seqResources.get(1);
-    secondTsFileResource.setClosed(false);
-    Set<String> devices = secondTsFileResource.getDevices();
-    // update the end time of the file to Long.MIN_VALUE, so we can simulate a real open file
-    Field timeIndexField = TsFileResource.class.getDeclaredField("timeIndex");
-    timeIndexField.setAccessible(true);
-    ITimeIndex timeIndex = (ITimeIndex) timeIndexField.get(secondTsFileResource);
-    ITimeIndex newTimeIndex =
-        IoTDBDescriptor.getInstance().getConfig().getTimeIndexLevel().getTimeIndex();
-    for (String device : devices) {
-      newTimeIndex.updateStartTime(device, timeIndex.getStartTime(device));
-    }
-    secondTsFileResource.setTimeIndex(newTimeIndex);
-    unseqResources.clear();
-    unseqResources.add(largeUnseqTsFileResource);
-
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    List[] result = mergeFileSelector.select();
-    assertEquals(0, result.length);
-    resource.clear();
-  }
-
-  /**
-   * test unseq merge select with the following files: {0seq-0-0-0.tsfile 0-100 1seq-1-1-0.tsfile
-   * 100-200 2seq-2-2-0.tsfile 200-300 3seq-3-3-0.tsfile 300-400 4seq-4-4-0.tsfile 400-500}
-   * {10unseq-10-10-0.tsfile 0-500}
-   */
-  @Test
-  public void testFileOpenSelectionFromCompaction()
-      throws IOException, WriteProcessException, NoSuchFieldException, IllegalAccessException {
-    File file =
-        new File(
-            TestConstant.BASE_OUTPUT_PATH.concat(
-                10
-                    + "unseq"
-                    + IoTDBConstant.FILE_NAME_SEPARATOR
-                    + 10
-                    + IoTDBConstant.FILE_NAME_SEPARATOR
-                    + 10
-                    + IoTDBConstant.FILE_NAME_SEPARATOR
-                    + 0
-                    + ".tsfile"));
-    TsFileResource largeUnseqTsFileResource = new TsFileResource(file);
-    largeUnseqTsFileResource.setClosed(true);
-    largeUnseqTsFileResource.setMinPlanIndex(10);
-    largeUnseqTsFileResource.setMaxPlanIndex(10);
-    largeUnseqTsFileResource.setVersion(10);
-    prepareFile(largeUnseqTsFileResource, 0, seqFileNum * ptNum, 0);
-
-    // update the second file's status to open
-    TsFileResource secondTsFileResource = seqResources.get(1);
-    secondTsFileResource.setClosed(false);
-    Set<String> devices = secondTsFileResource.getDevices();
-    // update the end time of the file to Long.MIN_VALUE, so we can simulate a real open file
-    Field timeIndexField = TsFileResource.class.getDeclaredField("timeIndex");
-    timeIndexField.setAccessible(true);
-    ITimeIndex timeIndex = (ITimeIndex) timeIndexField.get(secondTsFileResource);
-    ITimeIndex newTimeIndex =
-        IoTDBDescriptor.getInstance().getConfig().getTimeIndexLevel().getTimeIndex();
-    for (String device : devices) {
-      newTimeIndex.updateStartTime(device, timeIndex.getStartTime(device));
-    }
-    secondTsFileResource.setTimeIndex(newTimeIndex);
-    unseqResources.clear();
-    unseqResources.add(largeUnseqTsFileResource);
-
-    long timeLowerBound = System.currentTimeMillis() - Long.MAX_VALUE;
-    MergeResource mergeResource = new MergeResource(seqResources, unseqResources, timeLowerBound);
-    assertEquals(5, mergeResource.getSeqFiles().size());
-    assertEquals(1, mergeResource.getUnseqFiles().size());
-    mergeResource.clear();
-  }
-}