Details

Description

A connection strategy allows control over the way that ZooKeeper clients (we would implement this for both c and java apis) connect to a serving ensemble. Today we have two strategies, randomized round robin (default) and ordered round robin, both of which are hard coded into the client implementation. We would generalize this interface and allow users to create their own.

Activity

add a draft patch for c client. Here, I add two function prototypes to support the strategy pattern. The conn_chooser_fn is used to initialize the hosts list, before the prime connection, and the conn_picker_fn is used to descide which hosts will be used in the next connection.

the patch provide two build-in strategies, which support ordered round robin and randomized round robin like the previous version. Programmers can set their own chooser and piccker when they initalize the zookeeper handler.

Qian Ye
added a comment - 26/Nov/10 06:55 add a draft patch for c client. Here, I add two function prototypes to support the strategy pattern. The conn_chooser_fn is used to initialize the hosts list, before the prime connection, and the conn_picker_fn is used to descide which hosts will be used in the next connection.
typedef int (*conn_chooser_fn)(int addrs_count, int *connect_index,
struct sockaddr_storage *addrs);
typedef int (*conn_picker_fn)(int addrs_count, int *connect_index,
struct sockaddr_storage *addrs);
the patch provide two build-in strategies, which support ordered round robin and randomized round robin like the previous version. Programmers can set their own chooser and piccker when they initalize the zookeeper handler.

Hadoop QA
added a comment - 29/Nov/10 02:46 -1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12460486/ZOOKEEPER-781.patch
against trunk revision 1038827.
+1 @author. The patch does not contain any @author tags.
+1 tests included. The patch appears to include 18 new or modified tests.
-1 patch. The patch command could not apply the patch.
Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/52//console
This message is automatically generated.

Thomas Koch
added a comment - 29/Nov/10 08:05 Hi,
in ZOOKEEPER-836 I introduced a HostProvider interface for the java client. Different connection strategies could be implemented as instances of this interface.

a question about patch. the applied source path in the last version of the patch is wrong. I fixed this problem in the new patch. However, I found that "Available Workflow Actions" contains only three actions: Cancel Patch, Resolve Issue, Resume Progress. Which one should I use to test my new patch? Thanks.

Qian Ye
added a comment - 06/Dec/10 03:47 a question about patch. the applied source path in the last version of the patch is wrong. I fixed this problem in the new patch. However, I found that "Available Workflow Actions" contains only three actions: Cancel Patch, Resolve Issue, Resume Progress. Which one should I use to test my new patch? Thanks.

Hadoop QA
added a comment - 19/Jul/11 22:59 -1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12483681/ZOOKEEPER-781.patch
against trunk revision 1148553.
+1 @author. The patch does not contain any @author tags.
+1 tests included. The patch appears to include 18 new or modified tests.
-1 patch. The patch command could not apply the patch.
Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/401//console
This message is automatically generated.

While resolving the recent conflict I noticed that zookeeper_init signature is changed by this patch - that's not possible. We need to maintain backward compatibility at the API level. One way to address would be to introduce a new "zookeeper_init_with_strategy(....)" or some such new method. However we cannot change the existing API.

Patrick Hunt
added a comment - 20/Jul/11 00:02 While resolving the recent conflict I noticed that zookeeper_init signature is changed by this patch - that's not possible. We need to maintain backward compatibility at the API level. One way to address would be to introduce a new "zookeeper_init_with_strategy(....)" or some such new method. However we cannot change the existing API.