From ccd15fcb81521f7f139a82b512109fc772c5582a Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Thu, 15 Oct 2026 16:10:24 +0800 Subject: [PATCH] [Test] Fix deletion regression test flush control --- .../dataregion/memtable/TsFileProcessorTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 324bf78a37e0..61a672ebdcfe 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 @@ -229,14 +229,16 @@ public void testDeletionDuringFlushCompletionIsPersisted() throws Exception { SystemFileFactory.INSTANCE.getFile(filePath), sgInfo, this::closeTsFileProcessor, - (tsFileProcessor, updateMap, systemFlushTime) -> {}, + (tsFileProcessor, updateMap, systemFlushTime) -> { + // Take over flushing after asyncClose's guard, before FlushManager registration. + tsFileProcessor.setManagedByFlushManager(true); + }, true); processor.setTsFileProcessorInfo(new TsFileProcessorInfo(sgInfo)); sgInfo.initTsFileProcessorInfo(processor); TSRecord record = new TSRecord(deviceId, 1); record.addTuple(DataPoint.getDataPoint(dataType, measurementId, "1")); processor.insert(buildInsertRowNodeByTSRecord(record), new long[5]); - processor.setManagedByFlushManager(true); processor.asyncClose(); Assert.assertNull(processor.getWorkMemTable()); @@ -312,7 +314,10 @@ private void testDeletionWALWithoutWorkingMemTable(boolean tableModel) throws Ex SystemFileFactory.INSTANCE.getFile(filePath), sgInfo, this::closeTsFileProcessor, - (tsFileProcessor, updateMap, systemFlushTime) -> {}, + (tsFileProcessor, updateMap, systemFlushTime) -> { + // Take over flushing after asyncClose's guard, before FlushManager registration. + tsFileProcessor.setManagedByFlushManager(true); + }, true); processor.setTsFileProcessorInfo(new TsFileProcessorInfo(sgInfo)); sgInfo.initTsFileProcessorInfo(processor); @@ -331,7 +336,6 @@ private void testDeletionWALWithoutWorkingMemTable(boolean tableModel) throws Ex logDeletionForTest(tableModel, 2); // Use the production close path, while keeping flush execution under test control. - processor.setManagedByFlushManager(true); try { processor.asyncClose(); Assert.assertNull(processor.getWorkMemTable());