@Test
    public void testLookupLastLogIndexAndPosFromTail() {
        this.indexDB.startServiceManager();
        {
            this.indexDB.appendIndexAsync(1, 1, IndexType.IndexSegment);
            this.indexDB.appendIndexAsync(2, 2, IndexType.IndexSegment);
            final Pair<Integer, Long> posPair = this.indexDB.appendIndexAsync(3, 3, IndexType.IndexConf);
            this.indexDB.appendIndexAsync(4, 4, IndexType.IndexSegment);
            this.indexDB.waitForFlush(posPair.getSecond(), 100);
        }
        final Pair<IndexFile.IndexEntry, IndexFile.IndexEntry> indexPair = this.indexDB
            .lookupLastLogIndexAndPosFromTail();
        final IndexFile.IndexEntry lastSegmentIndex = indexPair.getFirst();
        final IndexFile.IndexEntry lastConfIndex = indexPair.getSecond();
        assert (lastSegmentIndex.getLogIndex() == 4);
        assert (lastConfIndex.getLogIndex() == 3);
    }
Test for Service , which enables auto flush
jraft-extension/java-log-storage-impl/src/test/java/com/alipay/sofa/jraft/storage/db/IndexDBTest.java