public void revertToSnapshot(long targetEpoch) {
        log.debug("Reverting to in-memory snapshot {}", targetEpoch);
        Snapshot target = getSnapshot(targetEpoch);
        Iterator<Snapshot> iterator = iterator(target);
        iterator.next();
        while (iterator.hasNext()) {
            Snapshot snapshot = iterator.next();
            log.debug("Deleting in-memory snapshot {} because we are reverting to {}",
                snapshot.epoch(), targetEpoch);
            iterator.remove();
        }
        target.handleRevert();
    }
Reverts the state of all data structures to the state at the given epoch.

@param targetEpoch       The epoch of the snapshot to revert to.
server-common/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java