@@ -175,11 +175,11 @@ enum SharePartitionState {
175
175
private final AtomicReference <Uuid > fetchLock ;
176
176
177
177
/**
178
- * The max in-flight messages is used to limit the number of records that can be in-flight at any
179
- * given time. The max in-flight messages is used to prevent the consumer from fetching too many
178
+ * The max in-flight records is used to limit the number of records that can be in-flight at any
179
+ * given time. The max in-flight records is used to prevent the consumer from fetching too many
180
180
* records from the leader and running out of memory.
181
181
*/
182
- private final int maxInFlightMessages ;
182
+ private final int maxInFlightRecords ;
183
183
184
184
/**
185
185
* The max delivery count is used to limit the number of times a record can be delivered to the
@@ -305,7 +305,7 @@ enum SharePartitionState {
305
305
String groupId ,
306
306
TopicIdPartition topicIdPartition ,
307
307
int leaderEpoch ,
308
- int maxInFlightMessages ,
308
+ int maxInFlightRecords ,
309
309
int maxDeliveryCount ,
310
310
int defaultRecordLockDurationMs ,
311
311
Timer timer ,
@@ -315,7 +315,7 @@ enum SharePartitionState {
315
315
GroupConfigManager groupConfigManager ,
316
316
SharePartitionListener listener
317
317
) {
318
- this (groupId , topicIdPartition , leaderEpoch , maxInFlightMessages , maxDeliveryCount , defaultRecordLockDurationMs ,
318
+ this (groupId , topicIdPartition , leaderEpoch , maxInFlightRecords , maxDeliveryCount , defaultRecordLockDurationMs ,
319
319
timer , time , persister , replicaManager , groupConfigManager , SharePartitionState .EMPTY , listener ,
320
320
new SharePartitionMetrics (groupId , topicIdPartition .topic (), topicIdPartition .partition ()));
321
321
}
@@ -326,7 +326,7 @@ enum SharePartitionState {
326
326
String groupId ,
327
327
TopicIdPartition topicIdPartition ,
328
328
int leaderEpoch ,
329
- int maxInFlightMessages ,
329
+ int maxInFlightRecords ,
330
330
int maxDeliveryCount ,
331
331
int defaultRecordLockDurationMs ,
332
332
Timer timer ,
@@ -341,7 +341,7 @@ enum SharePartitionState {
341
341
this .groupId = groupId ;
342
342
this .topicIdPartition = topicIdPartition ;
343
343
this .leaderEpoch = leaderEpoch ;
344
- this .maxInFlightMessages = maxInFlightMessages ;
344
+ this .maxInFlightRecords = maxInFlightRecords ;
345
345
this .maxDeliveryCount = maxDeliveryCount ;
346
346
this .cachedState = new ConcurrentSkipListMap <>();
347
347
this .lock = new ReentrantReadWriteLock ();
@@ -1302,7 +1302,7 @@ private boolean archiveCompleteBatch(InFlightBatch inFlightBatch, RecordState in
1302
1302
1303
1303
/**
1304
1304
* Checks if the records can be acquired for the share partition. The records can be acquired if
1305
- * the number of records in-flight is less than the max in-flight messages . Or if the fetch is
1305
+ * the number of records in-flight is less than the max in-flight records . Or if the fetch is
1306
1306
* to happen somewhere in between the record states cached in the share partition i.e. re-acquire
1307
1307
* the records that are already fetched before.
1308
1308
*
@@ -1312,7 +1312,7 @@ boolean canAcquireRecords() {
1312
1312
if (nextFetchOffset () != endOffset () + 1 ) {
1313
1313
return true ;
1314
1314
}
1315
- return numInFlightRecords () < maxInFlightMessages ;
1315
+ return numInFlightRecords () < maxInFlightRecords ;
1316
1316
}
1317
1317
1318
1318
/**
@@ -1492,24 +1492,24 @@ private void maybeUpdatePersisterGapWindowStartOffset(long offset) {
1492
1492
1493
1493
/**
1494
1494
* The method calculates the last offset and maximum records to acquire. The adjustment is needed
1495
- * to ensure that the records acquired do not exceed the maximum in-flight messages limit.
1495
+ * to ensure that the records acquired do not exceed the maximum in-flight records limit.
1496
1496
*
1497
1497
* @param fetchOffset The offset from which the records are fetched.
1498
1498
* @param maxFetchRecords The maximum number of records to acquire.
1499
1499
* @param lastOffset The last offset to acquire records to, which is the last offset of the fetched batch.
1500
1500
* @return LastOffsetAndMaxRecords object, containing the last offset to acquire and the maximum records to acquire.
1501
1501
*/
1502
1502
private LastOffsetAndMaxRecords lastOffsetAndMaxRecordsToAcquire (long fetchOffset , int maxFetchRecords , long lastOffset ) {
1503
- // There can always be records fetched exceeding the max in-flight messages limit. Hence,
1504
- // we need to check if the share partition has reached the max in-flight messages limit
1503
+ // There can always be records fetched exceeding the max in-flight records limit. Hence,
1504
+ // we need to check if the share partition has reached the max in-flight records limit
1505
1505
// and only acquire limited records.
1506
1506
int maxRecordsToAcquire ;
1507
1507
long lastOffsetToAcquire = lastOffset ;
1508
1508
lock .readLock ().lock ();
1509
1509
try {
1510
1510
int inFlightRecordsCount = numInFlightRecords ();
1511
- // Take minimum of maxFetchRecords and remaining capacity to fill max in-flight messages limit.
1512
- maxRecordsToAcquire = Math .min (maxFetchRecords , maxInFlightMessages - inFlightRecordsCount );
1511
+ // Take minimum of maxFetchRecords and remaining capacity to fill max in-flight records limit.
1512
+ maxRecordsToAcquire = Math .min (maxFetchRecords , maxInFlightRecords - inFlightRecordsCount );
1513
1513
// If the maxRecordsToAcquire is less than or equal to 0, then ideally (check exists to not
1514
1514
// fetch records for share partitions which are at capacity) the fetch must be happening
1515
1515
// in-between the in-flight batches i.e. some in-flight records have been released (marked
@@ -1522,15 +1522,15 @@ private LastOffsetAndMaxRecords lastOffsetAndMaxRecordsToAcquire(long fetchOffse
1522
1522
if (maxRecordsToAcquire <= 0 ) {
1523
1523
if (fetchOffset <= endOffset ()) {
1524
1524
// Adjust the max records to acquire to the capacity available to fill the max
1525
- // in-flight messages limit. This can happen when the fetch is happening in-between
1526
- // the in-flight batches and the share partition has reached the max in-flight messages limit.
1525
+ // in-flight records limit. This can happen when the fetch is happening in-between
1526
+ // the in-flight batches and the share partition has reached the max in-flight records limit.
1527
1527
maxRecordsToAcquire = Math .min (maxFetchRecords , (int ) (endOffset () - fetchOffset + 1 ));
1528
1528
// Adjust the last offset to acquire to the endOffset of the share partition.
1529
1529
lastOffsetToAcquire = endOffset ();
1530
1530
} else {
1531
- // The share partition is already at max in-flight messages , hence cannot acquire more records.
1532
- log .debug ("Share partition {}-{} has reached max in-flight messages limit: {}. Cannot acquire more records, inflight records count: {}" ,
1533
- groupId , topicIdPartition , maxInFlightMessages , inFlightRecordsCount );
1531
+ // The share partition is already at max in-flight records , hence cannot acquire more records.
1532
+ log .debug ("Share partition {}-{} has reached max in-flight records limit: {}. Cannot acquire more records, inflight records count: {}" ,
1533
+ groupId , topicIdPartition , maxInFlightRecords , inFlightRecordsCount );
1534
1534
}
1535
1535
}
1536
1536
} finally {
@@ -1558,13 +1558,13 @@ private ShareAcquiredRecords acquireNewBatchRecords(
1558
1558
firstAcquiredOffset = endOffset ;
1559
1559
}
1560
1560
1561
- // Check how many messages can be acquired from the batch.
1561
+ // Check how many records can be acquired from the batch.
1562
1562
long lastAcquiredOffset = lastOffset ;
1563
1563
if (maxFetchRecords < lastAcquiredOffset - firstAcquiredOffset + 1 ) {
1564
- // The max messages to acquire is less than the complete available batches hence
1564
+ // The max records to acquire is less than the complete available batches hence
1565
1565
// limit the acquired records. The last offset shall be the batches last offset
1566
- // which falls under the max messages limit. As the max fetch records is the soft
1567
- // limit, the last offset can be higher than the max messages .
1566
+ // which falls under the max records limit. As the max fetch records is the soft
1567
+ // limit, the last offset can be higher than the max records .
1568
1568
lastAcquiredOffset = lastOffsetFromBatchWithRequestOffset (batches , firstAcquiredOffset + maxFetchRecords - 1 );
1569
1569
// If the initial read gap offset window is active then it's not guaranteed that the
1570
1570
// batches align on batch boundaries. Hence, reset to last offset itself if the batch's
@@ -2193,7 +2193,7 @@ private boolean maybeUpdateCachedStateAndOffsets() {
2193
2193
a) Only full batches can be removed from the cachedState, For example if there is batch (0-99)
2194
2194
and 0-49 records are acknowledged (ACCEPT or REJECT), the first 50 records will not be removed
2195
2195
from the cachedState. Instead, the startOffset will be moved to 50, but the batch will only
2196
- be removed once all the messages (0-99) are acknowledged (ACCEPT or REJECT).
2196
+ be removed once all the records (0-99) are acknowledged (ACCEPT or REJECT).
2197
2197
*/
2198
2198
2199
2199
// Since only a subMap will be removed, we need to find the first and last keys of that subMap
0 commit comments