lucasbru commented on code in PR #17414:
URL: https://github.com/apache/kafka/pull/17414#discussion_r1810544183
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetchCollectorTest.java:
##########
@@ -620,10 +646,49 @@ public void
testCollectFetchInitializationOffsetOutOfRangeErrorWithOffsetReset()
final Fetch<String, String> fetch =
fetchCollector.collectFetch(fetchBuffer);
assertTrue(fetch.isEmpty());
+ assertEquals(0, fetch.nextOffsets().size());
verify(subscriptions).requestOffsetResetIfPartitionAssigned(topicPartition0);
verify(fetchBuffer).setNextInLineFetch(null);
}
+ @Test
+ public void testReadCommittedWithAbortedTransaction() {
+ buildDependencies(IsolationLevel.READ_COMMITTED);
+ int recordCount = 20;
+ assignAndSeek(topicAPartition0);
+
+
+ // Initial CompletedFetch
+ CompletedFetch initialCompletedFetch = completedFetchBuilder
+ .recordCount(recordCount)
+ .build();
+ fetchBuffer.add(initialCompletedFetch);
+ Fetch<String, String> fetch = fetchCollector.collectFetch(fetchBuffer);
+
+ assertFalse(fetch.isEmpty());
+ assertEquals(recordCount, fetch.numRecords());
+ assertEquals(1, fetch.nextOffsets().size());
+ assertEquals(new OffsetAndMetadata(fetch.numRecords(),
Optional.empty(), ""), fetch.nextOffsets().get(topicAPartition0));
+
+
+ // Subsequent CompletedFetch with abort marker
+ Records rawRecords =
createTranscactionalRecords(ControlRecordType.ABORT, recordCount);
+ FetchResponseData.PartitionData partitionData = new
FetchResponseData.PartitionData()
+ .setRecords(rawRecords);
Review Comment:
If I understand correctly, the Andrew was asking for the ABORT control
record to come first, before the other records.
--
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]