-
Notifications
You must be signed in to change notification settings - Fork 15k
KAFKA-14990: Dynamic producer ID expiration should be applied on a broker restart #13707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ac04be0
Dynamic producer ID expiration should be applied on a broker restart
splett2 1a127e1
Some debugging logs
splett2 38a6800
Remove debugging log statements
splett2 c5a1f1b
Dangling info log statement
splett2 adbd214
Restore original PR
splett2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,7 +183,11 @@ class ProducerIdExpirationTest extends KafkaServerTestHarness { | |
| ) | ||
|
|
||
| // Update the expiration time to a low value again. | ||
| admin.incrementalAlterConfigs(producerIdExpirationConfig("100")) | ||
| admin.incrementalAlterConfigs(producerIdExpirationConfig("100")).all().get() | ||
|
||
|
|
||
| // restart a broker to ensure that dynamic config changes are picked up on restart | ||
| killBroker(0) | ||
| restartDeadBrokers() | ||
|
|
||
| brokers.foreach(broker => TestUtils.waitUntilTrue(() => broker.logManager.producerStateManagerConfig.producerIdExpirationMs == 100, "Configuration was not updated.")) | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the other dynamic configs defs here? Just trying to figure out how this was missed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good question. It is probably worth making sure we have similar coverage for other dynamic broker configs. Looking at some other dynamic configs, eg:
LogCleanerThreadsProp, I would expect them to run into similar issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dynamic broker config code is quite hairy. I took a look and my high-level understanding what it does is the following:
DynamicBrokerConfig.updateCurrentConfig: Try to generate a newKafkaConfigfrom the set of properties persisted to Zookeeper. If the current config is equal to the new config, no-op. Otherwise, determine the set of reconfigurables that need to be updated based on the currently registered set of reconfigurables, apply those updates. Then update the current config.I added some logging and it looks like what is happening is the following:
KafkaServer.startup()we callconfig.dynamicConfig.initialize(Some(zkClient)). At this point, the set of recconfigurables is empty.Step #1 loads broker overrides from Zookeeper, but doesn't apply any changes since we have not added the reconfigurables yet. This means that the props just get applied to the current KafkaConfig, and the reconfiguration hooks defined in
DynamicBrokerConfigdon't fire. However, we do update the current KafkaConfig to include the updated props.Step #2 adds the reconfigurables so that post-startup configuration changes alter components.
Step #3 tries to load from Zookeeper the base props, but because #1 has already updated the current KafkaConfig to match the existing ZK state, we no-op again.