showuon commented on a change in pull request #11691:
URL: https://github.com/apache/kafka/pull/11691#discussion_r800030072



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java
##########
@@ -514,12 +512,11 @@ 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 idempotenceEnabled = 
this.getBoolean(ENABLE_IDEMPOTENCE_CONFIG);
+        if (!idempotenceEnabled && userConfiguredTransactions)
             throw new ConfigException("Cannot set a " + 
ProducerConfig.TRANSACTIONAL_ID_CONFIG + " without also enabling idempotence.");
+
         return userConfiguredTransactions || idempotenceEnabled;

Review comment:
       You are right! After we default the `enable.idempotence` to true, 
there's no way to have `idempotenceEnabled==false` but 
`userConfiguredTransactions==true`. Remove it.




-- 
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


Reply via email to