Parkerhiphop commented on code in PR #23578:
URL: https://github.com/apache/kafka/pull/23578#discussion_r4095239917
##########
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRecords.java:
##########
@@ -181,7 +184,11 @@ protected ConsumerRecord<K, V> makeNext() {
/**
* Returns whether this container has any records.
*
- * @return True if there are no records, false otherwise
+ * <p>This method checks whether the records map is empty. If the map
contains
+ * partitions mapped to empty lists, this method returns {@code false}
even if
+ * there are no records.
+ *
Review Comment:
How about describe the behavior more directly?
For example:
```
This method only checks whether the records map is empty. A partition with
an empty record list still makes the map non-empty, so this method returns
{@code false} even if there are no records.
```
##########
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRecords.java:
##########
@@ -54,6 +54,8 @@ public class ConsumerRecords<K, V> implements
Iterable<ConsumerRecord<K, V>> {
static final AtomicLong TAINTED_NEXT_OFFSETS_LAST_LOG_NS = new
AtomicLong(System.nanoTime() - TAINT_LOG_INTERVAL_NS);
/**
+ * @param records The records for each partition. Must not contain empty
lists;
Review Comment:
nit: I think describing the valid input directly makes the constraint a bit
clearer.
How about:
`Each partition must be mapped to a non-empty list;`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]