public boolean waitForFlush(final long maxExpectedFlushPosition, final int maxFlushTimes) {
        int cnt = 0;
        while (getFlushedPosition() < maxExpectedFlushPosition) {
            flush();
            cnt++;
            if (cnt > maxFlushTimes) {
                LOG.error("Try flush db {} times, but the flushPosition {} can't exceed expectedFlushPosition {}",
                    maxFlushTimes, getFlushedPosition(), maxExpectedFlushPosition);
                return false;
            }
        }
        return true;
    }
Flush db files and wait for flushPosition >= maxExpectedFlushPosition
@return true if flushPosition >= maxExpectedFlushPosition
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/db/AbstractDB.java