apoorvmittal10 commented on code in PR #17322:
URL: https://github.com/apache/kafka/pull/17322#discussion_r1808259876
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -513,18 +514,27 @@ public long nextFetchOffset() {
* fetched from the leader.
*
* @param memberId The member id of the client that is fetching
the record.
+ * @param maxFetchRecords The maximum number of records that should be
acquired, this is a soft
+ * limit and the method might acquire more
records than the maxFetchRecords,
+ * if the records are already part of the same
fetch batch.
* @param fetchPartitionData The fetched records for the share partition.
* @return The acquired records for the share partition.
*/
- public List<AcquiredRecords> acquire(
+ public ShareAcquiredRecords acquire(
String memberId,
+ int maxFetchRecords,
FetchPartitionData fetchPartitionData
) {
log.trace("Received acquire request for share partition: {}-{}
memberId: {}", groupId, topicIdPartition, memberId);
+ if (maxFetchRecords <= 0) {
+ // Nothing to acquire.
Review Comment:
It's a safe check in the method. As there could be multiple partitions in a
single share fetch request and a single partition might satisfy the max fetch
records criteria hence skip acquiring for other.
--
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]