Jialin Chen created ZOOKEEPER-5106:
--------------------------------------

             Summary: DnsSrvHostProvider ignores the refresh interval set in 
ZKClientConfig
                 Key: ZOOKEEPER-5106
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5106
             Project: ZooKeeper
          Issue Type: Bug
          Components: java client
    Affects Versions: 3.10.0
            Reporter: Jialin Chen


{{DnsSrvHostProvider}} receives the client's {{ZKClientConfig}}, and 
{{ZKClientConfig}} copies 
{{zookeeper.hostProvider.dnsSrvRefreshIntervalSeconds}} from the system 
properties like the other client settings, but the provider reads the interval 
with {{Long.getLong()}}. A value set in a client config file or with 
{{ZKClientConfig.setProperty()}} is therefore ignored.

Steps to reproduce (master at 48f7cb00e): a standalone server, a DNS server 
answering {{_zk._tcp.zk.test}} with an SRV record pointing to it, and a client 
config file containing
{noformat}
zookeeper.hostProvider.dnsSrvRefreshIntervalSeconds=1
{noformat}
A client created with {{new ZooKeeper("dns-srv://_zk._tcp.zk.test", 30000, 
watcher, new ZKClientConfig(configFile))}} is kept open for 3.5 seconds.

Expected: the SRV record is looked up about once per second.

Actual: it is looked up once, when the provider is created, and the provider 
keeps the 60 second default. Values {{0}} (disable refresh) and {{-1}} 
(invalid) in the config file have no effect either. Setting 
{{-Dzookeeper.hostProvider.dnsSrvRefreshIntervalSeconds=1}} does produce the 
periodic lookups, and when both are set the system property wins.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to