KIP-679: Update Producer defaults => enable_idempotence=True, acks='all'#3013
Merged
Conversation
Owner
dpkp
commented
May 28, 2026
- KIP-679: Refactor idempotence config resolution
- KIP-679: Enable strongest delivery guarantees by default
Replace the strict-fail check in KafkaProducer.__init__ with the Java client's KIP-679 resolution: when idempotence is on but the user has explicitly set a conflicting acks/retries/max_in_flight_requests, the client silently disables idempotence and logs a warning. Conflicts only raise when the user explicitly opted into idempotence (or set transactional_id, which forces strict mode). Broker version handling moves from an assert to a KafkaConfigurationError on explicit idempotence, or a warning + silent disable when idempotence came from defaults. acks remains user-specified (or -1) regardless of fallback. This commit only changes the resolution logic. The defaults (enable_idempotence=False, acks=1) are unchanged; flipping them is a follow-up. test/producer/test_kip679_config.py covers the explicit and transactional-strict paths; test_sender.py's existing max-in-flight rejection test is updated to match the new error message.
Flip KafkaProducer's DEFAULT_CONFIG to match Java's KIP-679 defaults:
enable_idempotence: False -> True
acks: 1 -> -1 ('all')
With the resolution machinery from the prior commit, users who pass a
conflicting acks/retries/max_in_flight without touching enable_idempotence
silently get the old non-idempotent behavior plus a warning log; users
who explicitly opt in to idempotence still get a hard error on conflicts.
Against pre-0.11 brokers, default-on idempotence is silently disabled
while acks=-1 is preserved (acks=all is valid on any wire version).
Docstrings updated. Three tests in test/producer/test_producer.py that
constructed KafkaProducer() with implicit defaults now pin
enable_idempotence=False since they target thread-shutdown/send-path
behavior, not idempotence. New silent-disable, opt-out, and old-broker
test cases added to test/producer/test_kip679_config.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.