Andrew Kyle Purtell created ZOOKEEPER-5136:
----------------------------------------------
Summary: (C client) Failover skips every other server because a
failed connect advances the server cursor twice
Key: ZOOKEEPER-5136
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5136
Project: ZooKeeper
Issue Type: Bug
Components: c client
Reporter: Andrew Kyle Purtell
Assignee: Andrew Kyle Purtell
Since ZOOKEEPER-1355 (3.5.0), a failed connect outside a reconfig pass moves
the C client's server cursor twice. {{handle_error()}} advances it once, and
{{zoo_cycle_next_server()}} advances it again before the next connect. As a
result, failover skips every other server. With an even sized server list, half
the servers are never tried, and the client never reaches the end-of-list
reconnect delay. With two servers, the client never tries the second one, so
losing the first server makes the ensemble unreachable.
The fix changes {{handle_error()}} so that, outside a reconfig pass, it only
records the next server and leaves the cursor alone, so the cursor moves once
per attempt. The fix ships as part of ZOOKEEPER-5121 (PR #2496), and a new test
in {{TestResolverFailure.cc}} checks that connect attempts alternate between
two refusing servers.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)