You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "cadonna (via GitHub)" <gi...@apache.org> on 2023/07/27 13:15:32 UTC
[GitHub] [kafka] cadonna commented on a diff in pull request #14103: HOTIFX: fix Kafka Streams upgrade path from 3.4 to 3.5
cadonna commented on code in PR #14103:
URL: https://github.com/apache/kafka/pull/14103#discussion_r1276250228
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/assignment/AssignorConfigurationTest.java:
##########
@@ -35,4 +53,52 @@ public void configsShouldRejectZeroWarmups() {
assertThat(exception.getMessage(), containsString("Invalid value 0 for configuration max.warmup.replicas"));
}
+
+ @Test
+ public void rebalanceProtocolShouldSupportAllUpgradeFromVersions() {
+ for (final String upgradeFrom : TestConfig.upgradeFromVersions()) {
+ config.put(StreamsConfig.UPGRADE_FROM_CONFIG, upgradeFrom);
+ final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(config);
+
+ // next call should not throw
+ assignorConfiguration.rebalanceProtocol();
Review Comment:
A more readable option without the need for a comment is:
```suggestion
try {
assignorConfiguration.rebalanceProtocol();
} catch (final Throwable throwable) {
throw new AssertionFailedError("Upgrade from " + upgradeFrom + " failed with " + throwable.getMessage() + "!");
}
```
##########
clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java:
##########
@@ -947,9 +947,15 @@ public String toString() {
}
public static class ValidString implements Validator {
- final List<String> validStrings;
+ // visible for testing
Review Comment:
I am not a fan of "visible for testing". What about the following:
1. We add an enum to `StreamsConfig`:
```java
public enum UpgradeFromValues {
UPGRADE_FROM_0100("0.10.0"),
...
UPGRADE_FROM_34("3.4");
private final String value;
UpgradeFromValues(final String value) {
this.value = value;
}
public String toString() {
return value;
}
}
```
2. We change the constants to:
```java
public static final String UPGRADE_FROM_34 = UpgradeFromValues.UPGRADE_FROM_34.toString();
```
3. We can use the enum in the tests and in the code.
##########
clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java:
##########
@@ -947,9 +947,15 @@ public String toString() {
}
public static class ValidString implements Validator {
- final List<String> validStrings;
+ // visible for testing
Review Comment:
Since we just add a constant enum to StreamsConfig and given the hotfix character, I would say we do not need a KIP for this.
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/assignment/AssignorConfigurationTest.java:
##########
@@ -35,4 +53,52 @@ public void configsShouldRejectZeroWarmups() {
assertThat(exception.getMessage(), containsString("Invalid value 0 for configuration max.warmup.replicas"));
}
+
+ @Test
+ public void rebalanceProtocolShouldSupportAllUpgradeFromVersions() {
+ for (final String upgradeFrom : TestConfig.upgradeFromVersions()) {
+ config.put(StreamsConfig.UPGRADE_FROM_CONFIG, upgradeFrom);
+ final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(config);
+
+ // next call should not throw
+ assignorConfiguration.rebalanceProtocol();
+ }
+ }
+
+ @Test
+ public void configuredMetadataVersionShouldSupportAllUpgradeFromVersions() {
+ for (final String upgradeFrom : TestConfig.upgradeFromVersions()) {
+ config.put(StreamsConfig.UPGRADE_FROM_CONFIG, upgradeFrom);
+ final AssignorConfiguration assignorConfiguration = new AssignorConfiguration(config);
+
+ // next call should not throw
+ assignorConfiguration.configuredMetadataVersion(0);
Review Comment:
See my previous comment.
--
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