public Pair<Integer, Integer> lookupFirstLogPosFromLogIndex(final long logIndex) {
        final long lastLogIndex = getLastLogIndex();
        int firstSegmentPos = -1;
        int firstConfPos = -1;
        long index = logIndex;
        while (index <= lastLogIndex) {
            final IndexEntry indexEntry = lookupIndex(index);
            if (indexEntry.getLogType() == IndexType.IndexSegment.getType() && firstSegmentPos == -1) {
                firstSegmentPos = indexEntry.getPosition();
            } else if (indexEntry.getLogType() == IndexType.IndexConf.getType() && firstConfPos == -1) {
                firstConfPos = indexEntry.getPosition();
            }
            if (firstSegmentPos > 0 && firstConfPos > 0) {
                break;
            }
            index++;
        }
        return Pair.of(firstSegmentPos, firstConfPos);
    }
@Test
    public void testLookupFirstLogPosFromLogIndex() {
        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.waitForFlush(posPair.getSecond(), 100);
        }

        final Pair<Integer, Integer> posPair = this.indexDB.lookupFirstLogPosFromLogIndex(1);
        final int firstSegmentPos = posPair.getFirst();
        final int firstConfPos = posPair.getSecond();
        assertEquals(firstSegmentPos, 1);
        assertEquals(firstConfPos, 3);
    }