You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/08/11 14:24:35 UTC
[GitHub] [kafka] chia7712 opened a new pull request, #12503: Appending value to LIST config should not generate empty string with …
chia7712 opened a new pull request, #12503:
URL: https://github.com/apache/kafka/pull/12503
We noticed this issue when appending value to `leader.replication.throttled.replicas`. The default value is empty string, so it produces `,0:0` rather than `0:0`. For another, parsing throttled replicas get failed when there is an empty string (see [parseThrottledPartitions](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/ConfigHandler.scala#L91))
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] chia7712 commented on a diff in pull request #12503: MINOR: Appending value to LIST config should not generate empty string with …
Posted by GitBox <gi...@apache.org>.
chia7712 commented on code in PR #12503:
URL: https://github.com/apache/kafka/pull/12503#discussion_r945401496
##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -2480,6 +2480,38 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
}
}
+ @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testAppendConfigToEmptyDefaultValue(ignored: String): Unit = {
+ testAppendConfig(new Properties(), "0:0", "0:0")
+ }
+
+ @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testAppendConfigToExistentValue(ignored: String): Unit = {
Review Comment:
yep
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] showuon commented on a diff in pull request #12503: Appending value to LIST config should not generate empty string with …
Posted by GitBox <gi...@apache.org>.
showuon commented on code in PR #12503:
URL: https://github.com/apache/kafka/pull/12503#discussion_r945237980
##########
core/src/main/scala/kafka/server/ConfigAdminManager.scala:
##########
@@ -496,9 +496,9 @@ object ConfigAdminManager {
if (!listType(alterConfigOp.configEntry.name, configKeys))
throw new InvalidConfigurationException(s"Config value append is not allowed for config key: ${alterConfigOp.configEntry.name}")
val oldValueList = Option(configProps.getProperty(alterConfigOp.configEntry.name))
- .orElse(Option(ConfigDef.convertToString(configKeys(configPropName).defaultValue, ConfigDef.Type.LIST)))
- .getOrElse("")
- .split(",").toList
+ .orElse(Option(ConfigDef.convertToString(configKeys(configPropName).defaultValue, ConfigDef.Type.LIST)).filter(s => s.nonEmpty))
Review Comment:
nit: `filter` can be in next line
##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -2480,6 +2480,27 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
}
}
+ @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testAppendConfigToEmptyDefaultValue(ignored: String): Unit = {
+ client = Admin.create(createConfig)
+ val topic = "testAppendConfigToEmptyDefaultValue"
+ createTopic(topic)
Review Comment:
Could we also add a test for the case that topic config already contains a `LeaderReplicationThrottledReplicasProp` value, to make sure the result is what we expected? Ex:
```java
val p = new Properties()
p.setProperty(LogConfig.LeaderReplicationThrottledReplicasProp, "1:1")
createTopic(topic, topicConfig = p)
...
assertEquals("1:1, 0:0", config.value())
```
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dengziming commented on a diff in pull request #12503: MINOR: Appending value to LIST config should not generate empty string with …
Posted by GitBox <gi...@apache.org>.
dengziming commented on code in PR #12503:
URL: https://github.com/apache/kafka/pull/12503#discussion_r945395086
##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -2480,6 +2480,38 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
}
}
+ @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testAppendConfigToEmptyDefaultValue(ignored: String): Unit = {
+ testAppendConfig(new Properties(), "0:0", "0:0")
+ }
+
+ @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName)
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testAppendConfigToExistentValue(ignored: String): Unit = {
Review Comment:
This test case will succeed even without this change, is it only used to improve test coverage?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] chia7712 commented on pull request #12503: MINOR: Appending value to LIST config should not generate empty string with …
Posted by GitBox <gi...@apache.org>.
chia7712 commented on PR #12503:
URL: https://github.com/apache/kafka/pull/12503#issuecomment-1214628757
I will merge it tomorrow if no objection.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] chia7712 commented on pull request #12503: MINOR: Appending value to LIST config should not generate empty string with …
Posted by GitBox <gi...@apache.org>.
chia7712 commented on PR #12503:
URL: https://github.com/apache/kafka/pull/12503#issuecomment-1214424416
@showuon thanks for all comments. I have addressed them. PTAL
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] chia7712 merged pull request #12503: MINOR: Appending value to LIST config should not generate empty string with …
Posted by GitBox <gi...@apache.org>.
chia7712 merged PR #12503:
URL: https://github.com/apache/kafka/pull/12503
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org