public void truncateNewEntries(long endOffset) {
        synchronized (voterSetHistory) {
            voterSetHistory.truncateNewEntries(endOffset);
        }
        synchronized (kraftVersionHistory) {
            kraftVersionHistory.truncateNewEntries(endOffset);
        }
    }
Remove the head of the log until the given offset.

@param endOffset the end offset (exclusive)
raft/src/main/java/org/apache/kafka/raft/internals/KRaftControlRecordStateMachine.java