kafka icon indicating copy to clipboard operation
kafka copied to clipboard

KAFKA-19026: AlterConfigPolicy incompatibility between ZK mode and KR…

Open edoardocomar opened this issue 9 months ago • 13 comments

…aft mode when using AlterConfigOp.OpType.SUBTRACT

Modified ZkAdminManager.scala so that on OpType.SUBTRACT the policy receives the modified configs, as happens in KRaft mode.

This similarly fixes the OpType.APPEND differences.

Note that the policy behavior on OpType.DELETE is different when altering Broker and Topic resources. For topics the policy does not see a map entry, for brokers the config value is null. This was the existing behavior for KRaft and this commit does not change that.

ClusterTest added.

edoardocomar avatar Mar 21 '25 15:03 edoardocomar

Note that the inconsistent DELETE behavior between Topic and Broker resources is present in the KRaft mode and described by https://issues.apache.org/jira/browse/KAFKA-19028

edoardocomar avatar Mar 21 '25 15:03 edoardocomar

@cmccabe @jsancio may you please take a look ? thanks

edoardocomar avatar Mar 24 '25 16:03 edoardocomar

I'd love to have this fix in 3.9.1 ...

edoardocomar avatar Mar 25 '25 10:03 edoardocomar

@showuon @frankvicky can we get this in 3.9.2 at least ?

edoardocomar avatar Apr 28 '25 08:04 edoardocomar

@showuon would you like to give this PR a 2nd look ?

edoardocomar avatar Jun 02 '25 15:06 edoardocomar

This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please leave a comment asking for a review. If the PR has merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact).

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

github-actions[bot] avatar Sep 01 '25 03:09 github-actions[bot]

This PR has been closed since it has not had any activity in 120 days. If you feel like this was a mistake, or you would like to continue working on it, please feel free to re-open the PR and ask for a review.

github-actions[bot] avatar Oct 02 '25 03:10 github-actions[bot]

Hi i rebased on the current 3.9 branch and re-ran the test included in this PR ./gradlew core:test --tests AlterConfigPolicyConfigsTest

the test fails for ZK mode without the fix

edoardocomar avatar Nov 11 '25 11:11 edoardocomar

IMHO, the failed tests in the CI Jenkins run are not related to this PR

edoardocomar avatar Nov 11 '25 16:11 edoardocomar

Hi @edoardocomar, after discussing with @chia7712, we think that this is kind of behavior change in ZK mode. It’s not ideal to include such a change in a patch release like 3.9.2. I know we already added documentation about this in 3.9.1, which mentions the known issue https://issues.apache.org/jira/browse/KAFKA-19026. How about we enhance that document by adding a clear example and summarizing the conclusion we’ve reached here?

FrankYang0529 avatar Nov 13 '25 15:11 FrankYang0529

The reason I developed this fix - which I have applied to all our kafka clusters in ZK mode, and has been running for many months is that it allows to plug in a simple AlterConfigPolicy that disallows clearing a topic's cleanup.policy. If a topic has an empty cleanup.policy, Kafka will allow it to grow forever.

This in my opinion is an extremely important AlterConfigPolicy that the admin of a Kafka cluster should implement. I don't think keeping backward compatibility in such a narrow field should prevail over correctness of behavior.

I am not interested to over document the issue. The release note was good enough for 3.9.1. Now it's a chance to get this fixed

edoardocomar avatar Nov 14 '25 10:11 edoardocomar

@ijuma do you have any suggestion for this PR? ZK's AlterConfigPolicy behavior is long-standing. Do we really want to change it in 3.9.2 to match KRaft?

FrankYang0529 avatar Nov 18 '25 15:11 FrankYang0529

I create a discussion thread for this in dev channel.

https://lists.apache.org/thread/bknho1vrvby1tpq634g744vqf4mr8coh

FrankYang0529 avatar Dec 03 '25 05:12 FrankYang0529