You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/29 20:02:36 UTC

[GitHub] [kafka] gharris1727 commented on a diff in pull request #12920: KAFKA-14339 : Do not perform producerCommit on serializationError when trying offsetWriter flush

gharris1727 commented on code in PR #12920:
URL: https://github.com/apache/kafka/pull/12920#discussion_r1035223460


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/ExactlyOnceWorkerSourceTaskTest.java:
##########
@@ -687,7 +687,26 @@ public void testCommitFlushCallbackFailure() throws Exception {
             callback.onCompletion(failure, null);
             return null;
         });
-        testCommitFailure(failure);
+        testCommitFailure(failure, false);
+    }
+
+    @Test
+    public void testCommitFlushAsyncCallbackFailure() throws Exception {
+        Exception failure = new RecordTooLargeException();
+        when(offsetWriter.willFlush()).thenReturn(true);
+        when(offsetWriter.beginFlush()).thenReturn(true);
+        // doFlush delegates it's callback to the producer,
+        // which delays completing the callback until commitTransaction
+        AtomicReference<Callback<Void>> callback = new AtomicReference<>();
+        when(offsetWriter.doFlush(any())).thenAnswer(invocation -> {
+            callback.set(invocation.getArgument(0));
+            return null;
+        });
+        doAnswer(invocation -> {
+            callback.get().onCompletion(failure, null);
+            throw failure;

Review Comment:
   this makes a lot of sense, thanks for catching this!



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org