showuon commented on a change in pull request #11691: URL: https://github.com/apache/kafka/pull/11691#discussion_r787413882
########## File path: clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java ########## @@ -514,11 +509,12 @@ public ProducerConfig(Map<String, Object> props) { } boolean idempotenceEnabled() { - boolean userConfiguredIdempotence = this.originals().containsKey(ENABLE_IDEMPOTENCE_CONFIG); - boolean userConfiguredTransactions = this.originals().containsKey(TRANSACTIONAL_ID_CONFIG); - boolean idempotenceEnabled = userConfiguredIdempotence && this.getBoolean(ENABLE_IDEMPOTENCE_CONFIG); - if (!idempotenceEnabled && userConfiguredIdempotence && userConfiguredTransactions) + boolean userConfiguredIdempotence = this.hasKeyInOriginals(ENABLE_IDEMPOTENCE_CONFIG); + boolean userConfiguredTransactions = this.hasKeyInOriginals(TRANSACTIONAL_ID_CONFIG); + boolean idempotenceEnabled = !userConfiguredIdempotence || this.getBoolean(ENABLE_IDEMPOTENCE_CONFIG); Review comment: the key fix: before the PR, we only considered the `idempotenceEnabled` when user explicitly set the config and value to `true`: ```java boolean idempotenceEnabled = userConfiguredIdempotence && this.getBoolean(ENABLE_IDEMPOTENCE_CONFIG); ``` Now, change it to fix the issue. ```java boolean idempotenceEnabled = !userConfiguredIdempotence || this.getBoolean(ENABLE_IDEMPOTENCE_CONFIG); ``` -- 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