IgnacioAcunaF opened a new pull request #10858:
URL: https://github.com/apache/kafka/pull/10858


   **Jira:**: https://issues.apache.org/jira/browse/KAFKA-12926
   
   Instead of setting "null" to negative offsets partition (as in KAFKA-9507), 
this PR aims to skip those cases from the returned list, because setting them 
in "null" can cause java.lang.NullPointerExceptions on downstreams methods that 
tries to access the data on them, because they are expecting an 
_OffsetAndMetadata_ and they encouter null values.
   
   For example, at ConsumerGroupCommand.scala at core:
   ```
     val partitionOffsets = consumerSummary.assignment.topicPartitions.asScala
               .map { topicPartition =>
                 topicPartition -> 
committedOffsets.get(topicPartition).map(_.offset)
               }.toMap
   ```
   If topicPartition has an negative offset, the 
committedOffsets.get(topicPartition) is null (as defined on KAFKA-9507), which 
translates into null.map(_.offset), which will lead to: _Error: Executing 
consumer group command failed due to null
   java.lang.NullPointerException_
   
   Unit tests added to assert that topics's partitions with an INVALID_OFFSET 
are not considered on the returned list of the consmer groups's offsets, so the 
downstream methods receive only valid _OffsetAndMetadata_ information.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to