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

jt2594838 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 c7d85f23c13 Fix fast compaction reviving the deleted data of aligned 
pages (#19341)
c7d85f23c13 is described below

commit c7d85f23c1341a1f243d55975c58c504f84f0d70
Author: Zhenyu Luo <[email protected]>
AuthorDate: Mon Nov 23 12:29:15 2026 +0800

    Fix fast compaction reviving the deleted data of aligned pages (#19341)
    
    * Fix fast compaction reviving the deleted data of aligned pages
    
    Fast compaction copied a value page whose data had been deleted completely
    when another value page of the same aligned page was not deleted, because
    such a page was flushed to the target file directly. The deletions are
    materialized by compaction and the target file does not inherit the source
    .mods, so the deleted data became visible again.
    
    Write an empty value page for a fully deleted page instead of copying it.
    
    Add FastAlignedCompactionWithDeletedValuePageTest which covers inner
    compaction, column-batched compaction and cross space compaction, and fix
    CompactionCheckerUtils so that aligned series are compared row by row
    instead of comparing only the first column.
    
    * Address review: assemble fully deleted value pages as empty pages
    
    Move the fully deleted value page handling into 
deserializeChunkIntoPageQueue,
    the common place where aligned pages are assembled, as suggested in review. 
A
    fully deleted value page is now kept with a null header and data, so the
    direct flush path writes an empty page and the page reader path reads all 
null
    values consistently instead of reviving the deleted data. The empty page is
    excluded from the written size accounting.
    
    Add a regression test that forces the pages to be deserialized to also cover
    the page reader path.
---
 .../fast/FastAlignedSeriesCompactionExecutor.java  |  34 +++-
 .../utils/writer/AbstractCompactionWriter.java     |  14 +-
 .../utils/writer/FastCrossCompactionWriter.java    |  20 +-
 .../utils/writer/FastInnerCompactionWriter.java    |  19 +-
 ...tAlignedCompactionWithDeletedValuePageTest.java | 209 +++++++++++++++++++++
 .../compaction/utils/CompactionCheckerUtils.java   |   2 +-
 6 files changed, 252 insertions(+), 46 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/fast/FastAlignedSeriesCompactionExecutor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/fast/FastAlignedSeriesCompactionExecutor.java
index 718373058f6..b336ebc5275 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/fast/FastAlignedSeriesCompactionExecutor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/fast/FastAlignedSeriesCompactionExecutor.java
@@ -334,19 +334,34 @@ public class FastAlignedSeriesCompactionExecutor extends 
SeriesCompactionExecuto
       valuePagesList.add(valuesPages);
     }
 
+    List<IChunkMetadata> valueChunkMetadataList =
+        ((AbstractAlignedChunkMetadata) chunkMetadataElement.chunkMetadata)
+            .getValueChunkMetadataList();
+
     // add aligned pages into page queue
     for (int i = 0; i < timePages.size(); i++) {
+      PageHeader timePageHeader = timePages.get(i).left;
       List<PageHeader> alignedPageHeaders = new ArrayList<>();
       List<ByteBuffer> alignedPageDatas = new ArrayList<>();
       for (int j = 0; j < valuePagesList.size(); j++) {
         if (valuePagesList.get(j) == null) {
+          // value chunk has been deleted completely
           alignedPageHeaders.add(null);
           alignedPageDatas.add(null);
           continue;
         }
         Pair<PageHeader, ByteBuffer> valuePage = valuePagesList.get(j).get(i);
-        alignedPageHeaders.add(valuePage == null ? null : valuePage.left);
-        alignedPageDatas.add(valuePage == null ? null : valuePage.right);
+        if (valuePage == null
+            || isValuePageFullyDeleted(valueChunkMetadataList.get(j), 
timePageHeader)) {
+          // A fully deleted value page is kept as an empty page (null header 
and data), so that
+          // it is written as an empty page when flushed directly and reads 
all null values when
+          // it is deserialized. Otherwise the deleted data would be revived 
in the target file.
+          alignedPageHeaders.add(null);
+          alignedPageDatas.add(null);
+          continue;
+        }
+        alignedPageHeaders.add(valuePage.left);
+        alignedPageDatas.add(valuePage.right);
       }
 
       AlignedPageElement alignedPageElement =
@@ -364,6 +379,16 @@ public class FastAlignedSeriesCompactionExecutor extends 
SeriesCompactionExecuto
     chunkMetadataElement.clearChunks();
   }
 
+  private static boolean isValuePageFullyDeleted(
+      IChunkMetadata valueChunkMetadata, PageHeader timePageHeader) {
+    return valueChunkMetadata != null
+        && AlignedSeriesBatchCompactionUtils.checkIsModified(
+                timePageHeader.getStartTime(),
+                timePageHeader.getEndTime(),
+                valueChunkMetadata.getDeleteIntervalList())
+            == ModifiedStatus.ALL_DELETED;
+  }
+
   @Override
   void readChunk(ChunkMetadataElement chunkMetadataElement) throws IOException 
{
     updateSummary(chunkMetadataElement, ChunkStatus.READ_IN);
@@ -448,8 +473,9 @@ public class FastAlignedSeriesCompactionExecutor extends 
SeriesCompactionExecuto
    * PARTIAL_DELETED means that there is data on this page been deleted. <br>
    * ALL_DELETED means that all data on this page has been deleted.
    *
-   * <p>Notice: If is aligned page, return ALL_DELETED if and only if all 
value pages are deleted.
-   * Return NONE_DELETED if and only if no data exists on all value pages is 
deleted
+   * <p>Notice: a fully deleted value page is assembled as an empty page in 
{@link
+   * #deserializeChunkIntoPageQueue}, so it is written as an empty page when 
flushed directly and
+   * reads all null values otherwise.
    */
   protected ModifiedStatus isPageModified(PageElement pageElement) {
     long startTime = pageElement.getStartTime();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
index 6d075f9d938..713a7a2ef81 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/AbstractCompactionWriter.java
@@ -383,23 +383,25 @@ public abstract class AbstractCompactionWriter implements 
AutoCloseable {
 
   protected void flushAlignedPageToChunkWriter(
       AlignedChunkWriterImpl alignedChunkWriter,
-      ByteBuffer compressedTimePageData,
-      PageHeader timePageHeader,
-      List<ByteBuffer> compressedValuePageDatas,
-      List<PageHeader> valuePageHeaders,
+      AlignedPageElement alignedPageElement,
       int subTaskId)
       throws IOException, PageException {
+    PageHeader timePageHeader = alignedPageElement.getTimePageHeader();
+    List<PageHeader> valuePageHeaders = 
alignedPageElement.getValuePageHeaders();
+    List<ByteBuffer> compressedValuePageDatas = 
alignedPageElement.getValuePageDataList();
     // seal current page
     alignedChunkWriter.sealCurrentPage();
     // flush new time page to chunk writer directly
-    
alignedChunkWriter.writePageHeaderAndDataIntoTimeBuff(compressedTimePageData, 
timePageHeader);
+    alignedChunkWriter.writePageHeaderAndDataIntoTimeBuff(
+        alignedPageElement.getTimePageData(), timePageHeader);
 
     long writtenValuePageSize = 0;
     // flush new value pages to chunk writer directly
     for (int i = 0; i < valuePageHeaders.size(); i++) {
       PageHeader valuePageHeader = valuePageHeaders.get(i);
       if (valuePageHeader == null) {
-        // sub sensor does not exist in current file or value page has been 
deleted completely
+        // sub sensor does not exist in current file or value page has been 
deleted completely;
+        // write an empty page, which is excluded from the size accounting 
below
         
alignedChunkWriter.getValueChunkWriterByIndex(i).writeEmptyPageToPageBuffer();
         continue;
       }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastCrossCompactionWriter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastCrossCompactionWriter.java
index de08d4ed4c0..a6bad23c6ed 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastCrossCompactionWriter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastCrossCompactionWriter.java
@@ -192,9 +192,6 @@ public class FastCrossCompactionWriter extends 
AbstractCrossCompactionWriter {
   public boolean flushAlignedPage(AlignedPageElement alignedPageElement, int 
subTaskId)
       throws IOException, PageException {
     PageHeader timePageHeader = alignedPageElement.getTimePageHeader();
-    List<PageHeader> valuePageHeaders = 
alignedPageElement.getValuePageHeaders();
-    ByteBuffer compressedTimePageData = alignedPageElement.getTimePageData();
-    List<ByteBuffer> compressedValuePageDatas = 
alignedPageElement.getValuePageDataList();
 
     checkTimeAndMayFlushChunkToCurrentFile(timePageHeader.getStartTime(), 
subTaskId);
     int fileIndex = seqFileIndexArray[subTaskId];
@@ -204,12 +201,7 @@ public class FastCrossCompactionWriter extends 
AbstractCrossCompactionWriter {
     }
 
     flushAlignedPageToChunkWriter(
-        (AlignedChunkWriterImpl) chunkWriters[subTaskId],
-        compressedTimePageData,
-        timePageHeader,
-        compressedValuePageDatas,
-        valuePageHeaders,
-        subTaskId);
+        (AlignedChunkWriterImpl) chunkWriters[subTaskId], alignedPageElement, 
subTaskId);
 
     // check chunk size and may open a new chunk
     checkChunkSizeAndMayOpenANewChunk(
@@ -229,9 +221,6 @@ public class FastCrossCompactionWriter extends 
AbstractCrossCompactionWriter {
       AbstractCompactionFlushController flushController)
       throws PageException, IOException {
     PageHeader timePageHeader = alignedPageElement.getTimePageHeader();
-    List<PageHeader> valuePageHeaders = 
alignedPageElement.getValuePageHeaders();
-    ByteBuffer compressedTimePageData = alignedPageElement.getTimePageData();
-    List<ByteBuffer> compressedValuePageDatas = 
alignedPageElement.getValuePageDataList();
 
     checkTimeAndMayFlushChunkToCurrentFile(timePageHeader.getStartTime(), 
subTaskId);
     int fileIndex = seqFileIndexArray[subTaskId];
@@ -244,12 +233,7 @@ public class FastCrossCompactionWriter extends 
AbstractCrossCompactionWriter {
     }
 
     flushAlignedPageToChunkWriter(
-        (AlignedChunkWriterImpl) chunkWriters[subTaskId],
-        compressedTimePageData,
-        timePageHeader,
-        compressedValuePageDatas,
-        valuePageHeaders,
-        subTaskId);
+        (AlignedChunkWriterImpl) chunkWriters[subTaskId], alignedPageElement, 
subTaskId);
 
     // check chunk size and may open a new chunk
     checkChunkSizeAndMayOpenANewChunk(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastInnerCompactionWriter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastInnerCompactionWriter.java
index ccac7b4c635..a9f034e2d38 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastInnerCompactionWriter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/writer/FastInnerCompactionWriter.java
@@ -178,8 +178,6 @@ public class FastInnerCompactionWriter extends 
AbstractInnerCompactionWriter {
       throws IOException, PageException {
     PageHeader timePageHeader = alignedPageElement.getTimePageHeader();
     List<PageHeader> valuePageHeaders = 
alignedPageElement.getValuePageHeaders();
-    ByteBuffer compressedTimePageData = alignedPageElement.getTimePageData();
-    List<ByteBuffer> compressedValuePageDatas = 
alignedPageElement.getValuePageDataList();
 
     checkPreviousTimestamp(timePageHeader.getStartTime(), subTaskId);
     boolean isUnsealedPageOverThreshold =
@@ -192,12 +190,7 @@ public class FastInnerCompactionWriter extends 
AbstractInnerCompactionWriter {
     }
 
     flushAlignedPageToChunkWriter(
-        (AlignedChunkWriterImpl) chunkWriters[subTaskId],
-        compressedTimePageData,
-        timePageHeader,
-        compressedValuePageDatas,
-        valuePageHeaders,
-        subTaskId);
+        (AlignedChunkWriterImpl) chunkWriters[subTaskId], alignedPageElement, 
subTaskId);
 
     checkChunkSizeAndMayOpenANewChunk(fileWriter, chunkWriters[subTaskId], 
subTaskId);
 
@@ -213,9 +206,6 @@ public class FastInnerCompactionWriter extends 
AbstractInnerCompactionWriter {
       AbstractCompactionFlushController flushController)
       throws PageException, IOException {
     PageHeader timePageHeader = alignedPageElement.getTimePageHeader();
-    List<PageHeader> valuePageHeaders = 
alignedPageElement.getValuePageHeaders();
-    ByteBuffer compressedTimePageData = alignedPageElement.getTimePageData();
-    List<ByteBuffer> compressedValuePageDatas = 
alignedPageElement.getValuePageDataList();
 
     checkPreviousTimestamp(timePageHeader.getStartTime(), subTaskId);
     if (flushController.shouldSealChunkWriter()) {
@@ -230,12 +220,7 @@ public class FastInnerCompactionWriter extends 
AbstractInnerCompactionWriter {
     }
 
     flushAlignedPageToChunkWriter(
-        (AlignedChunkWriterImpl) chunkWriters[subTaskId],
-        compressedTimePageData,
-        timePageHeader,
-        compressedValuePageDatas,
-        valuePageHeaders,
-        subTaskId);
+        (AlignedChunkWriterImpl) chunkWriters[subTaskId], alignedPageElement, 
subTaskId);
 
     checkChunkSizeAndMayOpenANewChunk(fileWriter, chunkWriters[subTaskId], 
subTaskId);
 
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/FastAlignedCompactionWithDeletedValuePageTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/FastAlignedCompactionWithDeletedValuePageTest.java
new file mode 100644
index 00000000000..18326610614
--- /dev/null
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/FastAlignedCompactionWithDeletedValuePageTest.java
@@ -0,0 +1,209 @@
+/*
+ * 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.storageengine.dataregion.compaction;
+
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.exception.MetadataException;
+import org.apache.iotdb.commons.path.IFullPath;
+import org.apache.iotdb.commons.path.MeasurementPath;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.exception.StorageEngineException;
+import 
org.apache.iotdb.db.storageengine.dataregion.compaction.constant.CompactionTaskType;
+import 
org.apache.iotdb.db.storageengine.dataregion.compaction.execute.performer.impl.FastCompactionPerformer;
+import 
org.apache.iotdb.db.storageengine.dataregion.compaction.execute.task.CrossSpaceCompactionTask;
+import 
org.apache.iotdb.db.storageengine.dataregion.compaction.execute.task.subtask.FastCompactionTaskSummary;
+import 
org.apache.iotdb.db.storageengine.dataregion.compaction.execute.utils.CompactionUtils;
+import 
org.apache.iotdb.db.storageengine.dataregion.compaction.utils.CompactionCheckerUtils;
+import 
org.apache.iotdb.db.storageengine.dataregion.modification.TreeDeletionEntry;
+import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResource;
+import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.generator.TsFileNameGenerator;
+import org.apache.iotdb.db.storageengine.dataregion.utils.TsFileResourceUtils;
+
+import org.apache.tsfile.exception.write.WriteProcessException;
+import org.apache.tsfile.file.metadata.enums.CompressionType;
+import org.apache.tsfile.file.metadata.enums.TSEncoding;
+import org.apache.tsfile.read.TimeValuePair;
+import org.apache.tsfile.read.common.TimeRange;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/** Verify that fast compaction does not copy the value pages that are deleted 
completely. */
+public class FastAlignedCompactionWithDeletedValuePageTest extends 
AbstractCompactionTest {
+
+  private static final String DEVICE = "d0";
+  private static final List<String> MEASUREMENTS = Arrays.asList("s0", "s1", 
"s2");
+  // one chunk with two pages, both of them are large enough to be flushed 
directly
+  private static final long FIRST_PAGE_START_TIME = 1;
+  private static final long FIRST_PAGE_END_TIME = 1000;
+  private static final long SECOND_PAGE_START_TIME = 2001;
+  private static final long SECOND_PAGE_END_TIME = 3000;
+
+  private FastCompactionTaskSummary summary;
+
+  @Before
+  public void setUp()
+      throws IOException, MetadataException, InterruptedException, 
WriteProcessException {
+    super.setUp();
+  }
+
+  @After
+  public void tearDown() throws IOException, StorageEngineException {
+    super.tearDown();
+  }
+
+  @Test
+  public void testFlushPageWithFullyDeletedValuePage() throws Exception {
+    
IoTDBDescriptor.getInstance().getConfig().setCompactionMaxAlignedSeriesNumInOneBatch(100);
+    unseqResources.add(createAlignedResource(false, 
Collections.singletonList("s1")));
+
+    TsFileResource targetResource = performInnerCompaction();
+
+    Assert.assertEquals(0, summary.pageNoneOverlapButDeserialize);
+    validate(targetResource, readRows(Collections.emptyList(), 
unseqResources));
+  }
+
+  @Test
+  public void testDeserializePageWithFullyDeletedValuePage() throws Exception {
+    
IoTDBDescriptor.getInstance().getConfig().setCompactionMaxAlignedSeriesNumInOneBatch(100);
+    // Force the pages to be deserialized instead of being flushed directly, 
so that the fully
+    // deleted value page is read back through the page reader.
+    
IoTDBDescriptor.getInstance().getConfig().setChunkSizeLowerBoundInCompaction(10240000);
+    
IoTDBDescriptor.getInstance().getConfig().setChunkPointNumLowerBoundInCompaction(200000);
+    unseqResources.add(createAlignedResource(false, 
Collections.singletonList("s1")));
+
+    TsFileResource targetResource = performInnerCompaction();
+
+    Assert.assertTrue(summary.pageNoneOverlapButDeserialize > 0);
+    validate(targetResource, readRows(Collections.emptyList(), 
unseqResources));
+  }
+
+  @Test
+  public void testFlushPageWithFullyDeletedValuePageInBatch() throws Exception 
{
+    
IoTDBDescriptor.getInstance().getConfig().setCompactionMaxAlignedSeriesNumInOneBatch(2);
+    unseqResources.add(createAlignedResource(false, Arrays.asList("s1", 
"s2")));
+
+    TsFileResource targetResource = performInnerCompaction();
+
+    validate(targetResource, readRows(Collections.emptyList(), 
unseqResources));
+  }
+
+  @Test
+  public void testFlushPageWithFullyDeletedValuePageInCrossSpaceCompaction() 
throws Exception {
+    
IoTDBDescriptor.getInstance().getConfig().setCompactionMaxAlignedSeriesNumInOneBatch(100);
+    seqResources.add(createAlignedResource(true, 
Collections.singletonList("s1")));
+    unseqResources.add(
+        generateSingleAlignedSeriesFile(
+            DEVICE,
+            MEASUREMENTS,
+            new TimeRange[][] {new TimeRange[] {new TimeRange(5001, 6000)}},
+            TSEncoding.RLE,
+            CompressionType.LZ4,
+            Arrays.asList(false, false, false),
+            false));
+    List<TimeValuePair> expected = readRows(seqResources, unseqResources);
+
+    Assert.assertTrue(
+        new CrossSpaceCompactionTask(
+                0,
+                tsFileManager,
+                seqResources,
+                unseqResources,
+                new FastCompactionPerformer(true),
+                0,
+                0)
+            .start());
+
+    List<TsFileResource> targetResources = tsFileManager.getTsFileList(true);
+    Assert.assertEquals(1, targetResources.size());
+    validate(targetResources.get(0), expected);
+  }
+
+  private TsFileResource createAlignedResource(boolean isSeq, List<String> 
deletedMeasurements)
+      throws IOException, IllegalPathException {
+    TsFileResource resource =
+        generateSingleAlignedSeriesFile(
+            DEVICE,
+            MEASUREMENTS,
+            new TimeRange[][] {
+              new TimeRange[] {
+                new TimeRange(FIRST_PAGE_START_TIME, FIRST_PAGE_END_TIME),
+                new TimeRange(SECOND_PAGE_START_TIME, SECOND_PAGE_END_TIME)
+              }
+            },
+            TSEncoding.RLE,
+            CompressionType.LZ4,
+            Arrays.asList(false, false, false),
+            isSeq);
+    for (String measurement : deletedMeasurements) {
+      resource
+          .getModFileForWrite()
+          .write(
+              new TreeDeletionEntry(
+                  new MeasurementPath(COMPACTION_TEST_SG + "." + DEVICE, 
measurement),
+                  FIRST_PAGE_END_TIME));
+    }
+    resource.getModFileForWrite().close();
+    return resource;
+  }
+
+  private TsFileResource performInnerCompaction() throws Exception {
+    tsFileManager.addAll(unseqResources, false);
+    TsFileResource targetResource =
+        
TsFileNameGenerator.getInnerCompactionTargetFileResource(unseqResources, false);
+    FastCompactionPerformer performer = new FastCompactionPerformer(false);
+    summary = new FastCompactionTaskSummary();
+    performer.setSummary(summary);
+    performer.setSourceFiles(unseqResources);
+    performer.setTargetFiles(Collections.singletonList(targetResource));
+    performer.perform();
+    CompactionUtils.moveTargetFile(
+        Collections.singletonList(targetResource),
+        CompactionTaskType.INNER_SEQ,
+        COMPACTION_TEST_SG);
+    return targetResource;
+  }
+
+  private void validate(TsFileResource targetResource, List<TimeValuePair> 
expected)
+      throws Exception {
+    TsFileResourceUtils.validateTsFileDataCorrectness(targetResource);
+    List<TimeValuePair> actual =
+        readRows(Collections.singletonList(targetResource), 
Collections.emptyList());
+    Assert.assertEquals(expected.size(), actual.size());
+    for (int i = 0; i < expected.size(); i++) {
+      Assert.assertEquals(expected.get(i).getTimestamp(), 
actual.get(i).getTimestamp());
+      Assert.assertArrayEquals(expected.get(i).getValues(), 
actual.get(i).getValues());
+    }
+  }
+
+  private List<TimeValuePair> readRows(
+      List<TsFileResource> seqResources, List<TsFileResource> unseqResources) 
throws Exception {
+    IFullPath path = getPaths(seqResources.isEmpty() ? unseqResources : 
seqResources).get(0);
+    return CompactionCheckerUtils.getDataByQuery(
+            Collections.singletonList(path), seqResources, unseqResources)
+        .get(path);
+  }
+}
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/utils/CompactionCheckerUtils.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/utils/CompactionCheckerUtils.java
index 63f4b4a7c70..6b5e9f4f691 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/utils/CompactionCheckerUtils.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/utils/CompactionCheckerUtils.java
@@ -648,7 +648,7 @@ public class CompactionCheckerUtils {
       while (reader.hasNextBatch()) {
         TsBlock batchData = reader.nextBatch();
         IPointReader pointReader;
-        if (path instanceof AlignedPath) {
+        if (path instanceof AlignedPath || path instanceof AlignedFullPath) {
           pointReader = batchData.getTsBlockAlignedRowIterator();
         } else {
           pointReader = batchData.getTsBlockSingleColumnIterator();

Reply via email to