KAFKA-19642: Replace dynamicPerBrokerConfigs with dynamicDefaultConfigs#20405
Conversation
junrao
left a comment
There was a problem hiding this comment.
@jim0987795064 : Thanks for the PR. A couple of comments. Also, could we add a test case?
| putOrRemoveIfNull(dynamicDefaultConfigs, configRecord.name(), configRecord.value()) | ||
| } else if (configRecord.resourceName() == config.brokerId.toString) { | ||
| putOrRemoveIfNull(dynamicPerBrokerConfigs, configRecord.name(), configRecord.value()) | ||
| putOrRemoveIfNull(dynamicDefaultConfigs, configRecord.name(), configRecord.value()) |
There was a problem hiding this comment.
Hmm, this doesn't look right. If configRecord.resourceName() == config.brokerId.toString, it's a broker level config and it seems that we should use dynamicPerBrokerConfigs.
| configHandler.processConfigChanges("", dynamicPerBrokerConfigs) | ||
| configHandler.processConfigChanges(config.brokerId.toString, dynamicPerBrokerConfigs) | ||
| configHandler.processConfigChanges("", dynamicDefaultConfigs) | ||
| configHandler.processConfigChanges(config.brokerId.toString, dynamicDefaultConfigs) |
There was a problem hiding this comment.
It seems that we should continue to use dynamicPerBrokerConfigs here?
There was a problem hiding this comment.
@junrao
Thanks for pointing this out. I've corrected the misused dynamicDefaultConfigs and now use dynamicPerBrokerConfigs for broker-scoped updates.
Thanks for the feedback. I'm still working on adding the test case and will update the PR once it's ready. |
Perhaps we could enhance
|
Signed-off-by: PoAn Yang <payang@apache.org>
|
|
||
| override def reconfigurableConfigs(): util.Set[String] = { | ||
| util.Set.of(PollingIntervalProp) | ||
| util.Set.of(PollingIntervalProp, ReplicationConfigs.NUM_REPLICA_FETCHERS_CONFIG) |
There was a problem hiding this comment.
@FrankYang0529 Thanks for your help. Could you please consider creating an individual metrics reporter for the new test? Including too many test cases in TestMetricsReporter could make it harder to understand
There was a problem hiding this comment.
Add another TestNumReplicaFetcherMetricsReporter for it.
There was a problem hiding this comment.
Please revert the change of TestMetricsReporter
Yunyung
left a comment
There was a problem hiding this comment.
Thanks for the PR. One nitpick,
| @volatile var closeCount = 0 | ||
| @volatile var clusterUpdateCount = 0 | ||
| @volatile var pollingInterval: Int = -1 | ||
| @volatile var numFetchers: Int = 1 |
There was a problem hiding this comment.
Maybe changing it to = 0 makes it clearer that it must be changed statically/dynamically.
There was a problem hiding this comment.
Please ignore this.
For this reason: https://issues.apache.org/jira/browse/KAFKA-19645 , it is probably more reasonable to keep it as 1 instead of setting invalid value.
| } | ||
|
|
||
| def verifyState(reconfigureCount: Int, deleteCount: Int, pollingInterval: Int): Unit = { | ||
| def verifyState(reconfigureCount: Int, deleteCount: Int, pollingInterval: Int, numFetcher: Int = 1): Unit = { |
There was a problem hiding this comment.
| def verifyState(reconfigureCount: Int, deleteCount: Int, pollingInterval: Int, numFetcher: Int = 1): Unit = { | |
| def verifyState(reconfigureCount: Int, deleteCount: Int, pollingInterval: Int, numFetcher: Int): Unit = { |
| // Add a new metrics reporter | ||
| val newProps = new Properties | ||
| newProps.put(TestMetricsReporter.PollingIntervalProp, "100") | ||
| newProps.put(ReplicationConfigs.NUM_REPLICA_FETCHERS_CONFIG, "1") |
There was a problem hiding this comment.
Should we change all verifyState calls in this method to numFetcher = 1? It's easier to understand, IMO.
Like reporters.foreach(_.verifyState(reconfigureCount = 0, deleteCount = 0, pollingInterval = 100, numFetcher=1))
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>
junrao
left a comment
There was a problem hiding this comment.
@jim0987795064 : Thanks for the updated PR. Just a minor comment.
|
|
||
| object TestNumReplicaFetcherMetricsReporter { | ||
| val testReporters = new ConcurrentLinkedQueue[TestNumReplicaFetcherMetricsReporter]() | ||
| val configuredBrokers = mutable.Set[Int]() |
| } | ||
|
|
||
|
|
||
| class TestNumReplicaFetcherMetricsReporter extends MetricsReporter with Reconfigurable with Closeable with ClusterResourceListener { |
There was a problem hiding this comment.
class TestNumReplicaFetcherMetricsReporter extends MetricsReporter
| @volatile var numFetchers: Int = 1 | ||
| testReporters.add(this) | ||
|
|
||
| override def contextChange(metricsContext: MetricsContext): Unit = { |
There was a problem hiding this comment.
we don't need to override the method with empty body
| override def metricRemoval(metric: KafkaMetric): Unit = { | ||
| } | ||
|
|
||
| override def onUpdate(clusterResource: ClusterResource): Unit = { |
Signed-off-by: PoAn Yang <payang@apache.org>
#20405) - **Changes**: Replace misused dynamicPerBrokerConfigs with dynamicDefaultConfigs - **Reasons**: KRaft servers don't handle the cluser-level configs in starting from: https://github.com/apache/kafka/pull/18949/files#r2296809389 Reviewers: Jun Rao <junrao@gmail.com>, Jhen-Yung Hsu <jhenyunghsu@gmail.com>, PoAn Yang <payang@apache.org>, Chia-Ping Tsai <chia7712@gmail.com> --------- Co-authored-by: PoAn Yang <payang@apache.org>
apache#20405) - **Changes**: Replace misused dynamicPerBrokerConfigs with dynamicDefaultConfigs - **Reasons**: KRaft servers don't handle the cluser-level configs in starting from: https://github.com/apache/kafka/pull/18949/files#r2296809389 Reviewers: Jun Rao <junrao@gmail.com>, Jhen-Yung Hsu <jhenyunghsu@gmail.com>, PoAn Yang <payang@apache.org>, Chia-Ping Tsai <chia7712@gmail.com> --------- Co-authored-by: PoAn Yang <payang@apache.org>
dynamicDefaultConfigs
starting
from: https://github.com/apache/kafka/pull/18949/files#r2296809389
Reviewers: Jun Rao junrao@gmail.com, Jhen-Yung Hsu
jhenyunghsu@gmail.com, PoAn Yang payang@apache.org, Chia-Ping Tsai
chia7712@gmail.com