1fanwang opened a new pull request, #23226: URL: https://github.com/apache/kafka/pull/23226
Persisted dynamic broker configs can fail to return to the active runtime after a KRaft broker restart when the local metadata snapshot is missing or stale. A value rolled out safely as `1 -> 2 -> 4` restarts from the static value `1`; replay then rejects `1 -> 4`, while the dynamic cache and cluster-default `DescribeConfigs` still report `4`. This loads cluster-default and per-broker configs together from `MetadataLoader`'s complete initial image before runtime components and quota managers are constructed. Live updates now validate public and broker reconfigurables before applying changes, and rejected pre-commit updates restore the prior dynamic maps. Same-instance restarts also clear values removed while the broker was offline. Fixes https://issues.apache.org/jira/browse/KAFKA-20890 ## Testing <details> <summary>Raw restart regression</summary> ```text $ ./gradlew core:test --tests 'kafka.server.DynamicBrokerReconfigurationTest.testRestoreDynamicConfigFromMetadataLog' # Before snapshot=none FAILED AssertionFailedError: active=1 cached=4 reportedDefault=4 namedBroker=1 ==> expected: <4> but was: <1> snapshot=stale FAILED AssertionFailedError: active=1 cached=4 reportedDefault=4 namedBroker=1 ==> expected: <4> but was: <1> snapshot=current PASSED 3 tests completed, 2 failed BUILD FAILED # After snapshot=none PASSED snapshot=stale PASSED snapshot=current PASSED BUILD SUCCESSFUL ``` </details> <details> <summary>Raw focused and full test output</summary> ```text $ ./gradlew core:test --tests 'kafka.server.metadata.BrokerMetadataPublisherTest' testInitialDynamicConfigFailureKeepsPublisherRemovable() PASSED BUILD SUCCESSFUL in 28s $ ./gradlew core:test --tests 'kafka.server.DynamicBrokerConfigTest' BUILD SUCCESSFUL in 4s $ ./gradlew core:test --tests 'kafka.server.DynamicBrokerReconfigurationTest' testRemoveDynamicConfigWhileBrokerIsStopped() PASSED snapshot=none PASSED snapshot=stale PASSED snapshot=current PASSED BUILD SUCCESSFUL in 5m 8s ``` </details> <details> <summary>Raw static checks</summary> ```text $ ./gradlew core:checkstyleMain core:checkstyleTest core:spotbugsMain core:spotbugsTest -x test > Task :core:checkstyleMain UP-TO-DATE > Task :core:checkstyleTest UP-TO-DATE > Task :core:spotbugsMain UP-TO-DATE > Task :core:spotbugsTest SKIPPED BUILD SUCCESSFUL in 3s $ ./gradlew spotlessCheck BUILD SUCCESSFUL in 2s ``` `spotbugsTest` is skipped because `core` has no Java test sources. </details> -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
