public void validatePositionsIfNeeded() {
        Map<TopicPartition, SubscriptionState.FetchPosition> partitionsToValidate =
                offsetFetcherUtils.getPartitionsToValidate();

        validatePositionsAsync(partitionsToValidate);
    }
Validate offsets for all assigned partitions for which a leader change has been detected.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetFetcher.java