@Test
  public void test01() throws IllegalPathException {
    IMemTable memTable1 = new PrimitiveMemTable(databasePath, dataRegionId);
    walNode1.onMemTableCreated(memTable1, logDirectory1 + "/" + "fake.tsfile");
    walNode1.log(
        memTable1.getMemTableId(),
        generateInsertRowNode(devicePath, System.currentTimeMillis(), 1));
    walNode1.log(
        memTable1.getMemTableId(),
        generateInsertRowNode(devicePath, System.currentTimeMillis(), 2));
    walNode1.log(
        memTable1.getMemTableId(),
        generateInsertRowNode(devicePath, System.currentTimeMillis(), 3));

    IMemTable memTable2 = new PrimitiveMemTable(databasePath, dataRegionId);
    walNode1.onMemTableCreated(memTable2, logDirectory1 + "/" + "fake.tsfile");
    walNode1.log(
        memTable2.getMemTableId(),
        generateInsertRowNode(devicePath, System.currentTimeMillis(), 4));
    walNode1.log(
        memTable2.getMemTableId(),
        generateInsertRowNode(devicePath, System.currentTimeMillis(), 5));
    walNode1.log(
        memTable2.getMemTableId(),
        generateInsertRowNode(devicePath, System.currentTimeMillis(), 6));

    Awaitility.await().until(() -> walNode1.isAllWALEntriesConsumed());
    Map<Long, Set<Long>> memTableIdsOfWal = walNode1.getWALBuffer().getMemTableIdsOfWal();
    Assert.assertEquals(1, memTableIdsOfWal.size());
    Assert.assertEquals(2, memTableIdsOfWal.get(0L).size());
    Assert.assertEquals(1, WALFileUtils.listAllWALFiles(new File(logDirectory1)).length);
    walNode1.close();
  }
The simulation here is to write the last file, because serialization and disk flushing
operations are asynchronous, so you have to wait until all the entries are processed to get the
correct result, when WalEntry is not consumed to get memTableIdsOfWal, the result is not
accurate, so when the actual deletion of expired wal files, Don't read the last wal file.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WalDeleteOutdatedNewTest.java