Skip to content

CONFLUENT: Cherry pick idempotent-by-default fixes from Apache Kafka#671

Merged
Rajini Sivaram (rajinisivaram) merged 4 commits into
3.1from
CONFLUENT-cherry-pick-idempotent
Mar 3, 2022
Merged

CONFLUENT: Cherry pick idempotent-by-default fixes from Apache Kafka#671
Rajini Sivaram (rajinisivaram) merged 4 commits into
3.1from
CONFLUENT-cherry-pick-idempotent

Conversation

@rajinisivaram

Copy link
Copy Markdown

Cherry-pick:

One conflict in KafkaProducerTest.java since a new test was added in another commit in AK 3.1 which is not yet in confluentinc/kafka 3.1.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Luke Chen (showuon) and others added 4 commits March 3, 2022 18:12
…configs (apache#11691)

In v3.0, we changed the default value for `enable.idempotence` to true, but we didn't adjust the validator and the `idempotence` enabled check method. So if a user didn't explicitly enable idempotence, this feature won't be turned on. This patch addresses the problem, cleans up associated logic, and fixes tests that broke as a result of properly applying the new default. Specifically it does the following:

1. fix the `ProducerConfig#idempotenceEnabled` method, to make it correctly detect if `idempotence` is enabled or not
2. remove some unnecessary config overridden and checks due to we already default `acks`, `retries` and `enable.idempotence` configs.
3. move the config validator for the idempotent producer from `KafkaProducer` into `ProducerConfig`. The config validation should be the responsibility of `ProducerConfig` class.
4. add an `AbstractConfig#hasKeyInOriginals` method, to avoid `originals` configs get copied and only want to check the existence of the key.
5. fix many broken tests. As mentioned, we didn't actually enable idempotence in v3.0. After this PR, there are some tests broken due to some different behavior between idempotent and non-idempotent producer.
6. add additional tests to validate configuration behavior

Reviewers: Kirk True <kirk@mustardgrain.com>, Ismael Juma <ismael@juma.me.uk>, Mickael Maison <mimaison@users.noreply.github.com>, Jason Gustafson <jason@confluent.io>
Remove 3.2 notes which were accidentally included after cherry-picking apache#11691. Add the section about the idempotence bug in 3.1 notable items.

Reviewers: Luke Chen <showuon@gmail.com>, Jason Gustafson <jason@confluent.io>
…1757)

* Mention `acks=1` to `acks=all` change in 3.0.0 upgrade docs
* Have a separate section for 3.0.1 and 3.1.1 as some may skip the
  3.0.0/3.1.0 section when upgrading to a bug fix.
* Move the 3.0.0 note to the top since it's more impactful than the
  other changes.

Reviewers: Jason Gustafson <jason@confluent.io>
Disable idempotence when conflicting config values for acks, retries
and max.in.flight.requests.per.connection are set by the user. For the
former two configs, we log at info level when we disable idempotence
due to conflicting configs. For the latter, we log at warn level since
it's due to an implementation detail that is likely to be surprising.

This mitigates compatibility impact of enabling idempotence by default.

Added unit tests to verify the change in behavior.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>, Mickael Maison <mickael.maison@gmail.com>
@rajinisivaram
Rajini Sivaram (rajinisivaram) requested a review from a team March 3, 2022 21:10

@ijuma Ismael Juma (ijuma) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if the tests pass.

@rajinisivaram

Copy link
Copy Markdown
Author

Ismael Juma (@ijuma) Thanks for the review. One unrelated flaky test (kafka.server.ReplicaManagerTest.[1] usesTopicIds=true), passes locally, merging to 3.1 with the separate commits.

@rajinisivaram
Rajini Sivaram (rajinisivaram) deleted the CONFLUENT-cherry-pick-idempotent branch March 3, 2022 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants