public void deleteSnapshotsUpTo(long targetEpoch) {
        for (Iterator<Snapshot> iterator = iterator(); iterator.hasNext(); ) {
            Snapshot snapshot = iterator.next();
            if (snapshot.epoch() >= targetEpoch) {
                return;
            }
            iterator.remove();
        }
    }
Deletes all the snapshots up to the given epoch

@param targetEpoch       The epoch to delete up to.
server-common/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java