[
https://issues.apache.org/jira/browse/ZOOKEEPER-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14078246#comment-14078246
]
Raul Gutierrez Segales commented on ZOOKEEPER-1998:
---------------------------------------------------
I actually didn't look at 3.4! Since the code looked new, I just guessed. But,
it turns out the that getaddrs is only called from zookeeper_init in 3.4
(unless I am overlooking something):
https://github.com/apache/zookeeper/blob/branch-3.4/src/c/src/zookeeper.c#L836
bq. Do you have thoughts on how we could avoid this? I suppose we could easily
just check if the addrvec is the same and if it is bypass resolving the hosts.
Well, but lookups should only happen upon reconnects right? When things are
healthy (i.e.: connected), it doesn't matter if we have (even new) unresolved
hosts. So I'd say we only call resolve_hosts() when a new connection is
needed.. Thoughts?
> C library calls getaddrinfo unconditionally from zookeeper_interest
> -------------------------------------------------------------------
>
> Key: ZOOKEEPER-1998
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1998
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.5.0
> Reporter: Raul Gutierrez Segales
> Assignee: Raul Gutierrez Segales
> Priority: Critical
> Fix For: 3.5.0
>
>
> (commented this on ZOOKEEPER-338)
> I've just noticed that we call getaddrinfo from zookeeper_interest... on
> every call. So from zookeeper_interest we always call update_addrs:
> https://github.com/apache/zookeeper/blob/trunk/src/c/src/zookeeper.c#L2082
> which in turns unconditionally calls resolve_hosts:
> https://github.com/apache/zookeeper/blob/trunk/src/c/src/zookeeper.c#L787
> which does the unconditional calls to getaddrinfo:
> https://github.com/apache/zookeeper/blob/trunk/src/c/src/zookeeper.c#L648
> We should fix this since it'll make 3.5.0 slower for people relying on DNS. I
> think this is happened as part of ZOOKEEPER-107 in which the list of servers
> can be updated.
> cc: [~shralex], [~phunt], [~fpj]
--
This message was sent by Atlassian JIRA
(v6.2#6252)