-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
PIP 45: Deprecate zookeeper settings #14147
PIP 45: Deprecate zookeeper settings #14147
Conversation
To deprecate the zookeeper settings. PIP 45 introduced unified metadata store API for Pulsar, so we should make the metadata related configuration start with `metadataStore`, not `zooKeeper`. change `zooKeeperSessionTimeoutMillis` to `metadataStoreSessionTimeoutMillis` change `zooKeeperOperationTimeoutSeconds` to `metadataStoreOperationTimeoutSeconds` change `zooKeeperCacheExpirySeconds` to `metadataStoreCacheExpirySeconds` Introduced set method for the deprecated configurations. If the broker read the configurations from the old version config file, the configuration loader will use the set method to apply the configued value to new configurations. Add new test to make sure the change will not introduce regression.
f2c1186
to
dcea79d
Compare
f.set(obj, value(trim(v), f)); | ||
try { | ||
Method method = Reflections.getSetMethod(obj.getClass(), f); | ||
method.invoke(obj, value(v, f)); |
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.
v --> trim(v) ?
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.
Done.
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.
LGTM
@FieldContext( | ||
category = CATEGORY_SERVER, | ||
doc = "ZooKeeper cache expiry time in seconds" | ||
doc = "ZooKeeper cache expiry time in seconds. " |
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.
You'd better use deprecated = true
in fieldContext instead of doc.
testConfigFile.delete(); | ||
} | ||
try (PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(testConfigFile)))) { | ||
printWriter.println("zooKeeperSessionTimeoutMillis=60"); |
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.
can you add another test where the configuration contains both zooKeeper* and metadataStore* properties ?
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.
@nicoloboschi I have changed the PR, could you please help review it again?
@@ -1609,9 +1609,6 @@ public static WorkerConfig initializeWorkerConfigFromBrokerConfig(ServiceConfigu | |||
workerConfig.setAuthorizationEnabled(brokerConfig.isAuthorizationEnabled()); | |||
workerConfig.setAuthorizationProvider(brokerConfig.getAuthorizationProvider()); | |||
workerConfig.setConfigurationMetadataStoreUrl(brokerConfig.getConfigurationMetadataStoreUrl()); | |||
workerConfig.setZooKeeperSessionTimeoutMillis(brokerConfig.getZooKeeperSessionTimeoutMillis()); | |||
workerConfig.setZooKeeperOperationTimeoutSeconds(brokerConfig.getZooKeeperOperationTimeoutSeconds()); | |||
|
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.
Seems that we need to set metadataStoreSessionTimeoutMillis etc. for the workerConfig here.
@FieldContext(doc = "ZooKeeper session timeout in milliseconds. " | ||
+ "@deprecated - Use metadataStoreSessionTimeoutMillis instead.") | ||
private long zooKeeperSessionTimeoutMillis = 30000; |
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.
@FieldContext(doc = "ZooKeeper session timeout in milliseconds. " | |
+ "@deprecated - Use metadataStoreSessionTimeoutMillis instead.") | |
private long zooKeeperSessionTimeoutMillis = 30000; | |
@Deprecated | |
@FieldContext(doc = "ZooKeeper session timeout in milliseconds. " | |
+ "@deprecated - Use metadataStoreSessionTimeoutMillis instead.", | |
deprecated = true) | |
private long zooKeeperSessionTimeoutMillis = 30000; |
It's better to add deprecated
here.
@FieldContext(doc = "ZooKeeper cache expiry time in seconds. " | ||
+ "@deprecated - Use metadataStoreCacheExpirySeconds instead.") | ||
private int zooKeeperCacheExpirySeconds = 300; |
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.
@FieldContext(doc = "ZooKeeper cache expiry time in seconds. " | |
+ "@deprecated - Use metadataStoreCacheExpirySeconds instead.") | |
private int zooKeeperCacheExpirySeconds = 300; | |
@Deprecated | |
@FieldContext(doc = "ZooKeeper cache expiry time in seconds. " | |
+ "@deprecated - Use metadataStoreCacheExpirySeconds instead.", | |
deprecated = true) | |
private int zooKeeperCacheExpirySeconds = 300; |
It's better to add deprecated
here.
@nicoloboschi @Jason918 @RobertIndie @hangc0276 @nodece I have pushed new commits to make sure the change will not break running Pulsar in the Docker environment because we are using a script to change the config value. For the helm chart, it will use the new config file but with old config names, as @nicoloboschi mentioned both of the new configs and the deprecated configs will be present in the new config file. So I changed the default value of the deprecated configs to |
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Outdated
Show resolved
Hide resolved
@@ -53,5 +59,55 @@ public void testConfigFileDefaults() throws Exception { | |||
} | |||
} | |||
|
|||
@Test | |||
public void testBackwardCompatibility() throws IOException { |
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.
what about testZooKeeperConfigurationBackwardCompatibilty ?
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.
I want to keep testBackwardCompatibility(), if we have other changes need to keep backward compatibility, we can just add items to the test, otherwise, we need many tests methods.
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.
LGTM
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.
+1, great work
* Deprecate zookeeper settings To deprecate the zookeeper settings. PIP 45 introduced unified metadata store API for Pulsar, so we should make the metadata related configuration start with `metadataStore`, not `zooKeeper`. change `zooKeeperSessionTimeoutMillis` to `metadataStoreSessionTimeoutMillis` change `zooKeeperOperationTimeoutSeconds` to `metadataStoreOperationTimeoutSeconds` change `zooKeeperCacheExpirySeconds` to `metadataStoreCacheExpirySeconds` Introduced set method for the deprecated configurations. If the broker read the configurations from the old version config file, the configuration loader will use the set method to apply the configued value to new configurations. Add new test to make sure the change will not introduce regression. * Apply comment * Apply comment * Apply comment * Apply comment * Apply comment.
Motivation
To deprecate the zookeeper settings. PIP 45 introduced a unified metadata store API for Pulsar,
so we should make the metadata-related configuration start with
metadataStore
, notzooKeeper
.Modification
change
zooKeeperSessionTimeoutMillis
tometadataStoreSessionTimeoutMillis
change
zooKeeperOperationTimeoutSeconds
tometadataStoreOperationTimeoutSeconds
change
zooKeeperCacheExpirySeconds
tometadataStoreCacheExpirySeconds
Compatibility
Introduced set method for the deprecated configurations. If the broker read the configurations
from the old version config file, the configuration loader will use the set method to apply the
configured value to new configurations.
Tests
Add new tests to make sure the change will not introduce a regression.