public void transitionToUnattached(int epoch) {
        int currentEpoch = state.epoch();
        if (epoch <= currentEpoch) {
            throw new IllegalStateException("Cannot transition to Unattached with epoch= " + epoch +
                " from current state " + state);
        }

        final long electionTimeoutMs;
        if (isObserver()) {
            electionTimeoutMs = Long.MAX_VALUE;
        } else if (isCandidate()) {
            electionTimeoutMs = candidateStateOrThrow().remainingElectionTimeMs(time.milliseconds());
        } else if (isVoted()) {
            electionTimeoutMs = votedStateOrThrow().remainingElectionTimeMs(time.milliseconds());
        } else if (isUnattached()) {
            electionTimeoutMs = unattachedStateOrThrow().remainingElectionTimeMs(time.milliseconds());
        } else {
            electionTimeoutMs = randomElectionTimeoutMs();
        }

        durableTransitionTo(new UnattachedState(
            time,
            epoch,
            OptionalInt.empty(),
            partitionState.lastVoterSet().voterIds(),
            state.highWatermark(),
            electionTimeoutMs,
            logContext
        ));
    }
Transition to the "unattached" state. This means we have found an epoch greater than the current epoch,
but we do not yet know of the elected leader.
raft/src/main/java/org/apache/kafka/raft/QuorumState.java