Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ public Map<TopicIdPartition, NodeAcknowledgements> takeAcknowledgedRecords() {
public int renew(Map<TopicIdPartition, Acknowledgements> acknowledgementsMap, Optional<Integer> acquisitionLockTimeoutMs) {
int recordsRenewed = 0;
for (Map.Entry<TopicIdPartition, Acknowledgements> entry : acknowledgementsMap.entrySet()) {
recordsRenewed += batches.get(entry.getKey()).renew(entry.getValue());
ShareInFlightBatch<K, V> batch = batches.get(entry.getKey());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good defensive check, but just out of curiosity, what causes this to end up being null?

if (batch != null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on the NPE. Only nit: can we add a brief note on renew that missing batches are intentionally skipped?

recordsRenewed += batch.renew(entry.getValue());
}
Copy link
Copy Markdown
Contributor

@aliehsaeedii aliehsaeedii Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1- Does that make sense to add such a test (as you mentioned you hitted in once during testing)
2- When a batch is not found, the code silently skips it. This might be correct behavior (I'm not sure), but
does that make sense to log sth there?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suspicion is that I temporarily broke the code while working on another PR on trunk and it revealed that this piece of code was a bit less defensive than it should have been. I'll finish off the larger trunk PR later this week, and I will enhance this small 4.2 PR if necessary. @chia7712 @nileshkumar3

}
acquisitionLockTimeoutMsRenewed = acquisitionLockTimeoutMs;
return recordsRenewed;
Expand Down
Loading