@TestOnly
  public void forceFlushAndRelease() {
    boolean needFlush;
    while (true) {
      needFlush = false;
      for (CachedMTreeStore store : regionToStoreMap.values()) {
        if (store.getMemoryManager().getBufferNodeNum() > 0) {
          needFlush = true;
          break;
        }
      }
      if (needFlush) {
        scheduler.scheduleFlushAll().join();
        scheduler.scheduleRelease(true);
      } else {
        break;
      }
    }
  }
If there is a ReleaseTask or FlushTask, block the current thread to wait up to
MAX_WAITING_TIME_WHEN_RELEASING. The thread will be woken up if the ReleaseTask or FlushTask
ends or the wait time exceeds MAX_WAITING_TIME_WHEN_RELEASING.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/ReleaseFlushMonitor.java