You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Dricmoy (via GitHub)" <gi...@apache.org> on 2026/10/16 04:40:34 UTC

[PR] KAFKA-7187: Implement MockConsumer offsetsForTimes [kafka]

Dricmoy opened a new pull request, #23834:
URL: https://github.com/apache/kafka/pull/23834

   ## Summary
   
   Implement `MockConsumer.offsetsForTimes` by scanning the mock consumer's records for the first record whose timestamp is greater than or equal to the requested timestamp.
   
   The implementation:
   
   - validates negative timestamps
   - returns `null` when no matching record exists
   - preserves leader epoch information
   - propagates configured offset exceptions
   - adds focused unit coverage for successful lookups and edge cases
   
   This revives the implementation direction explored in #5560 and #5561 by Nicolas Catusse.
   
   ## Testing
   
   - `./gradlew :clients:test --tests org.apache.kafka.clients.consumer.MockConsumerTest`
   - `./gradlew :clients:test`
   - `./gradlew :clients:checkstyleMain :clients:checkstyleTest`
   - `./gradlew :clients:spotbugsMain :clients:spotbugsTest`
   
   This contribution is my original work, and I license it to the Apache Kafka project under the project's open source license.
   
   JIRA: https://issues.apache.org/jira/browse/KAFKA-7187


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-7187: Implement MockConsumer offsetsForTimes [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23834:
URL: https://github.com/apache/kafka/pull/23834#issuecomment-6486906768

   A label of 'needs-attention' was automatically added to this PR in order to raise the
   attention of the committers. Once this issue has been triaged, the `triage` label
   should be removed to prevent this automation from happening again.


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-7187: Implement MockConsumer offsetsForTimes [kafka]

Posted by "Dricmoy (via GitHub)" <gi...@apache.org>.
Dricmoy commented on PR #23834:
URL: https://github.com/apache/kafka/pull/23834#issuecomment-6208226696

   Credit to @nucatus for the earlier implementation work in #5560 and #5561 that informed this update.


-- 
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: jira-unsubscribe@kafka.apache.org

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