@Override
    public boolean truncatePrefix(final long firstIndexKept) {
        if (!isOldStorageExist()) {
            return this.newLogStorage.truncatePrefix(firstIndexKept);
        }

        if (firstIndexKept < this.thresholdIndex) {
            return this.oldLogStorage.truncatePrefix(firstIndexKept);
        }

        // When firstIndex >= thresholdIndex, we can reset the old storage the shutdown it.
        if (isOldStorageExist()) {
            this.oldLogStorage.reset(1);
            shutdownOldLogStorage();
            LOG.info("Truncate prefix at logIndex : {}, the thresholdIndex is : {}, shutdown oldLogStorage success!",
                firstIndexKept, this.thresholdIndex);
        }
        return this.newLogStorage.truncatePrefix(firstIndexKept);
    }
HybridLogStorage is used to be compatible with new and old logStorage
@author hzh (642256541@qq.com)
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/HybridLogStorage.java