public void deleteSnapshot(Snapshot snapshot) {
        Snapshot prev = snapshot.prev();
        if (prev != head) {
            prev.mergeFrom(snapshot);
        } else {
            snapshot.erase();
        }
        log.debug("Deleting in-memory snapshot {}", snapshot.epoch());
        snapshots.remove(snapshot.epoch(), snapshot);
    }
Deletes the given snapshot.

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