This is an automated email from the ASF dual-hosted git repository. Caideyipi pushed a commit to branch codex/remove-ordinary-flush-tests-dev13 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit bad7f131d46a90d8eca995a685d5d3394dc4bc2b Author: Caideyipi <[email protected]> AuthorDate: Thu Dec 3 20:07:45 2026 +0800 [To dev/1.3] Remove ordinary async flush tests --- .../storageengine/dataregion/DataRegionTest.java | 85 ---------------------- 1 file changed, 85 deletions(-) diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java index 3bdcbd96596..8aeef6a9175 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java @@ -57,7 +57,6 @@ import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.Compacti import org.apache.iotdb.db.storageengine.dataregion.compaction.selector.constant.InnerSequenceCompactionSelector; import org.apache.iotdb.db.storageengine.dataregion.compaction.selector.constant.InnerUnsequenceCompactionSelector; import org.apache.iotdb.db.storageengine.dataregion.compaction.utils.CompactionConfigRestorer; -import org.apache.iotdb.db.storageengine.dataregion.flush.FlushListener; import org.apache.iotdb.db.storageengine.dataregion.flush.FlushManager; import org.apache.iotdb.db.storageengine.dataregion.flush.TsFileFlushPolicy; import org.apache.iotdb.db.storageengine.dataregion.memtable.IMemTable; @@ -121,7 +120,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; @@ -2229,89 +2227,6 @@ public class DataRegionTest { FileMetrics.getInstance().getModFileNum()); } - @Test - public void testFullFlushClosesProcessorAfterOrdinaryAsyncFlush() throws Exception { - final TSRecord record = new TSRecord(100, deviceId); - record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(100))); - dataRegion.insert(buildInsertRowNodeByTSRecord(record)); - - final TsFileProcessor tsFileProcessor = - dataRegion.getWorkSequenceTsFileProcessors().iterator().next(); - final TsFileResource tsFileResource = tsFileProcessor.getTsFileResource(); - tsFileProcessor.asyncFlush(); - final Future<?> ordinaryFlushFuture = tsFileProcessor.getCloseFuture(); - Assert.assertNotNull(ordinaryFlushFuture); - ordinaryFlushFuture.get(); - - Assert.assertFalse(tsFileProcessor.alreadyMarkedClosing()); - Assert.assertFalse(tsFileResource.isClosed()); - - dataRegion.syncCloseAllWorkingAndClosingTsFileProcessors(); - - Assert.assertTrue(tsFileResource.isClosed()); - Assert.assertFalse(dataRegion.getWorkSequenceTsFileProcessors().contains(tsFileProcessor)); - } - - @Test - public void testFullFlushWaitsForRunningOrdinaryAsyncFlush() throws Exception { - final CountDownLatch ordinaryFlushBlocked = new CountDownLatch(1); - final CountDownLatch allowOrdinaryFlush = new CountDownLatch(1); - dataRegion.setCustomFlushListeners( - Collections.singletonList( - new FlushListener() { - @Override - public void onMemTableFlushStarted(final IMemTable memTable) { - // Do nothing. - } - - @Override - public void onMemTableFlushed(final IMemTable memTable) { - ordinaryFlushBlocked.countDown(); - try { - allowOrdinaryFlush.await(); - } catch (final InterruptedException e) { - Thread.currentThread().interrupt(); - throw new AssertionError(e); - } - } - })); - - final TSRecord record = new TSRecord(100, deviceId); - record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(100))); - dataRegion.insert(buildInsertRowNodeByTSRecord(record)); - final TsFileProcessor tsFileProcessor = - dataRegion.getWorkSequenceTsFileProcessors().iterator().next(); - final TsFileResource tsFileResource = tsFileProcessor.getTsFileResource(); - - tsFileProcessor.asyncFlush(); - Assert.assertTrue(ordinaryFlushBlocked.await(30, TimeUnit.SECONDS)); - final CompletableFuture<Void> fullFlushFuture = - CompletableFuture.runAsync( - () -> { - try { - dataRegion.syncCloseAllWorkingAndClosingTsFileProcessors(); - } catch (final InterruptedException e) { - Thread.currentThread().interrupt(); - throw new CompletionException(e); - } catch (final ExecutionException e) { - throw new CompletionException(e); - } - }); - - try { - fullFlushFuture.get(200, TimeUnit.MILLISECONDS); - Assert.fail(); - } catch (final TimeoutException expected) { - // The full flush must wait until the ordinary flush releases the processor. - } finally { - allowOrdinaryFlush.countDown(); - } - - fullFlushFuture.get(30, TimeUnit.SECONDS); - Assert.assertTrue(tsFileResource.isClosed()); - Assert.assertFalse(dataRegion.getWorkSequenceTsFileProcessors().contains(tsFileProcessor)); - } - @Test public void testFullFlushDoesNotChaseProcessorCreatedAfterSnapshot() throws Exception { final CountDownLatch closeListenerBlocked = new CountDownLatch(1);
