Set<TopicPartition> bufferedPartitions() {
        try {
            lock.lock();

            final Set<TopicPartition> partitions = new HashSet<>();

            if (nextInLineFetch != null && !nextInLineFetch.isConsumed()) {
                partitions.add(nextInLineFetch.partition);
            }

            completedFetches.forEach(cf -> partitions.add(cf.partition));
            return partitions;
        } finally {
            lock.unlock();
        }
    }
Return the set of {@link TopicPartition partitions} for which we have data in the buffer.

@return {@link TopicPartition Partition} set
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java