This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 999ac07  Increase watch-znode.py connection timeout (#1864)
999ac07 is described below

commit 999ac073985ba64a5542adf34274f230c31ad7ff
Author: Ivan Kelly <[email protected]>
AuthorDate: Mon Jun 4 19:13:34 2018 +0200

    Increase watch-znode.py connection timeout (#1864)
    
    * Increase watch-znode.py connection timeout
    
    watch-znode is used in integration tests to ensure that initialization
    has occurred before booting brokers and proxies. By default kazoo uses
    a 10 second connection timeout. However, on occasion zookeeper could
    take longer than 10 seconds to come up depending on the order that
    containers are started and the load on the machine.
    
    This patch increases the connect timeout to a very high value (1h). If
    zookeeper doesn't come up within the hour, the test will fail in other
    places, and the containers will be torn down.
    
    * Add infinite connection retry
    
    * Rather than long timeout, short timeout, infinite retry
---
 docker/pulsar/scripts/watch-znode.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/docker/pulsar/scripts/watch-znode.py 
b/docker/pulsar/scripts/watch-znode.py
index 24ce19b..5075353 100755
--- a/docker/pulsar/scripts/watch-znode.py
+++ b/docker/pulsar/scripts/watch-znode.py
@@ -18,8 +18,11 @@
 # under the License.
 #
 
-import sys, getopt, time
+import sys, getopt, time, logging
 from kazoo.client import KazooClient
+from kazoo.retry import KazooRetry
+
+logging.getLogger('kazoo.client').addHandler(logging.StreamHandler())
 
 def usage():
     print >> sys.stderr, "\n%s -z <zookeeper> -p <path> [-w|-c|-e]" % 
(sys.argv[0])
@@ -77,7 +80,7 @@ if (not watch and not create and not exists):
     usage()
     sys.exit(5)
 
-zk = KazooClient(hosts=zookeeper)
+zk = KazooClient(hosts=zookeeper, timeout=1, 
connection_retry=KazooRetry(max_tries=-1))
 zk.start()
 
 if create:

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to