vamossagar12 commented on code in PR #12784: URL: https://github.com/apache/kafka/pull/12784#discussion_r1006758803
########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/ExactlyOnceWorkerSourceTask.java: ########## @@ -280,16 +280,18 @@ private void commitTransaction() { // Commit the transaction // Blocks until all outstanding records have been sent and ack'd - try { - producer.commitTransaction(); - } catch (Throwable t) { - log.error("{} Failed to commit producer transaction", ExactlyOnceWorkerSourceTask.this, t); - flushError.compareAndSet(null, t); + Throwable error = flushError.get(); + if (error == null) { Review Comment: Can this be the else block of https://github.com/apache/kafka/pull/12784/files#diff-6073f350e3c1c4ca7334407b32d162012543dad6bcc048cc970f3d11e852e5f2L293? Seems like `transactionOpen = false;` is anyways being set in this case. WDYT? ########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/ExactlyOnceWorkerSourceTask.java: ########## @@ -280,16 +280,18 @@ private void commitTransaction() { // Commit the transaction // Blocks until all outstanding records have been sent and ack'd - try { - producer.commitTransaction(); - } catch (Throwable t) { - log.error("{} Failed to commit producer transaction", ExactlyOnceWorkerSourceTask.this, t); - flushError.compareAndSet(null, t); + Throwable error = flushError.get(); + if (error == null) { + try { + producer.commitTransaction(); + } catch (Throwable t) { + log.error("{} Failed to commit producer transaction", ExactlyOnceWorkerSourceTask.this, t); + flushError.compareAndSet(null, t); + } } - transactionOpen = false; - Throwable error = flushError.get(); + error = flushError.get(); Review Comment: This call is redundant? `error` is already set to `flushError.get()` -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org