You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by "CCCLL (via GitHub)" <gi...@apache.org> on 2026/10/19 06:01:53 UTC
[PR] DnsSrvHostProvider ignores the refresh interval set in ZKClientConfig [zookeeper]
CCCLL opened a new pull request, #2479:
URL: https://github.com/apache/zookeeper/pull/2479
`DnsSrvHostProvider` receives the client's `ZKClientConfig`, and `ZKClientConfig` copies `zookeeper.hostProvider.dnsSrvRefreshIntervalSeconds` from the system properties like the other client settings, but the refresh interval was read with `Long.getLong()`. A value set in a client config file or with `ZKClientConfig.setProperty()` was ignored, so the provider kept refreshing every 60 seconds (or used whatever the system property said).
The interval is now read from the given `ZKClientConfig`, falling back to a new `ZKClientConfig` when none is passed, the same way `HostConnectionManager` does. The system property keeps working because `ZKClientConfig` is initialized from it.
Behaviour changes, both limited to this new 3.10.0 provider:
- A value in the client config now takes precedence over the system property, as it does for the other client properties.
- A non-numeric value used to be silently replaced by the 60 second default; it now fails the provider construction with a `NumberFormatException`, consistent with how a negative value is rejected and how `zookeeper.request.timeout` is handled.
### Testing
- New `DnsSrvHostProviderTest#testRefreshIntervalFromClientConfig` (interval `1` in `ZKClientConfig`, expects a periodic lookup) and `#testRefreshIntervalNegativeInClientConfig` (`-1` in `ZKClientConfig` is rejected) fail without the fix and pass with it. The existing system property tests still pass.
- `org.apache.zookeeper.client.*Test`, `HostProviderSelectionTest`, `StaticHostProviderTest`, `ConnectStringParserTest` and `CustomHostProviderTest` pass; checkstyle and spotbugs report no issues.
- End to end against a standalone server and a local DNS responder serving the SRV record: a client created with `new ZooKeeper("dns-srv://...", ..., new ZKClientConfig(configFile))`, where the file sets the interval to 1, sent 1 SRV query during a 3.5 second session before the fix and 4 (one per second) after it.
--
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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] ZOOKEEPER-5106: DnsSrvHostProvider ignores the refresh interval set in ZKClientConfig [zookeeper]
Posted by "kezhuw (via GitHub)" <gi...@apache.org>.
kezhuw commented on code in PR #2479:
URL: https://github.com/apache/zookeeper/pull/2479#discussion_r4344429381
##########
zookeeper-server/src/main/java/org/apache/zookeeper/client/DnsSrvHostProvider.java:
##########
@@ -199,9 +199,10 @@ public void close() {
}
}
- private long getRefreshInterval() {
+ private long getRefreshInterval(final ZKClientConfig clientConfig) {
+ final ZKClientConfig config = clientConfig == null ? new ZKClientConfig() : clientConfig;
Review Comment:
Shall we construct a `ZKClientConfig` if none provided and pass it to `HostConnectionManager` ? So the two see a consistent view of client config.
--
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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] ZOOKEEPER-5106: DnsSrvHostProvider ignores the refresh interval set in ZKClientConfig [zookeeper]
Posted by "kezhuw (via GitHub)" <gi...@apache.org>.
kezhuw commented on code in PR #2479:
URL: https://github.com/apache/zookeeper/pull/2479#discussion_r4373200970
##########
zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java:
##########
Review Comment:
I would prefer to initialize `clientConfig` to non null here so we don't make mistake again.
--
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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] ZOOKEEPER-5106: DnsSrvHostProvider ignores the refresh interval set in ZKClientConfig [zookeeper]
Posted by "CCCLL (via GitHub)" <gi...@apache.org>.
CCCLL commented on code in PR #2479:
URL: https://github.com/apache/zookeeper/pull/2479#discussion_r4346382364
##########
zookeeper-server/src/main/java/org/apache/zookeeper/client/DnsSrvHostProvider.java:
##########
@@ -199,9 +199,10 @@ public void close() {
}
}
- private long getRefreshInterval() {
+ private long getRefreshInterval(final ZKClientConfig clientConfig) {
+ final ZKClientConfig config = clientConfig == null ? new ZKClientConfig() : clientConfig;
Review Comment:
Thanks, done in b08df2580. `DnsSrvHostProvider` now creates the `ZKClientConfig` once when none is given and hands the same instance to `HostConnectionManager` and the refresh interval lookup. As you suggested in the review, the `ZooKeeper` constructor now also passes its non-null `clientConfig` to `HostProviderFactory`, so the client and the host provider see the same config.
--
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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] ZOOKEEPER-5106: DnsSrvHostProvider ignores the refresh interval set in ZKClientConfig [zookeeper]
Posted by "CCCLL (via GitHub)" <gi...@apache.org>.
CCCLL commented on code in PR #2479:
URL: https://github.com/apache/zookeeper/pull/2479#discussion_r4396479927
##########
zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java:
##########
Review Comment:
Done in 0ebc4a998: `clientConfig` is replaced with a new `ZKClientConfig` right where it is read from the options, so the rest of the constructor, including the `HostProviderFactory` call, only sees the non-null one.
--
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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] ZOOKEEPER-5106: DnsSrvHostProvider ignores the refresh interval set in ZKClientConfig [zookeeper]
Posted by "CCCLL (via GitHub) via notifications" <no...@zookeeper.apache.org>.
CCCLL commented on PR #2479:
URL: https://github.com/apache/zookeeper/pull/2479#issuecomment-6912369444
Thanks for the reviews. The remaining `ZKClientConfig` feedback was addressed in [`0ebc4a9`](https://github.com/apache/zookeeper/pull/2479/commits/0ebc4a998cfa2cfd1e27de66a244e81aa77ab839).
The failed Actions run hit [`-Werror=discarded-qualifiers` in the C client's `cli.c`](https://github.com/apache/zookeeper/actions/runs/40624493650/job/123418474304#step:6:1955). The same error shows up in #2480 and in a [pre-fix `master` build](https://github.com/apache/zookeeper/actions/runs/41685740399/job/126090862956). After #2487 pinned the CI and Website runners to Ubuntu 24.04, [all four Maven jobs](https://github.com/apache/zookeeper/actions/runs/41764917239) and the [Website build](https://github.com/apache/zookeeper/actions/runs/41764917241) passed on that `master` commit.
Could we get a fresh CI and Website run for this PR against `master` with #2487 included? GitHub reruns use the original SHA, so a fresh run would pick up the runner fix.
--
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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org