AndrewJSchofield commented on code in PR #17965:
URL: https://github.com/apache/kafka/pull/17965#discussion_r1862582872
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -643,7 +643,7 @@ public ShareAcquiredRecords acquire(
// acquire subset of offsets from the in-flight batch
but only if the
// complete batch is available yet. Hence, do a
pre-check to avoid exploding
// the in-flight offset tracking unnecessarily.
- if (inFlightBatch.batchState() !=
RecordState.AVAILABLE) {
+ if (inFlightBatch.batchState() !=
RecordState.AVAILABLE || inFlightBatch.batchRollbackState() != null) {
Review Comment:
Now, actually, `batchRollbackState()` will throw an exception if the
rollback state is null. That's probably not what you mean here. Maybe
`hashBatchRollbackState()` that doesn't throw an exception would be better.
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1225,7 +1225,7 @@ private int acquireSubsetBatchRecords(
break;
}
- if (offsetState.getValue().state != RecordState.AVAILABLE) {
+ if (offsetState.getValue().state != RecordState.AVAILABLE ||
offsetState.getValue().rollbackState() != null) {
log.trace("The offset is not available skipping, offset:
{} batch: {}"
Review Comment:
I would change the log line here for commonality with the others in terms of
the order of inserts. I suggest:
```
log.trace("The offset {} is not available in share partition: {}-{},
skipping: {}",
offsetState.getKey(), groupId, topicIdPartition, inFlightBatch);
```
--
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]