Skip to content

Commit

Permalink
Increase watch-znode.py connection timeout (apache#1864)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ivankelly authored and merlimat committed Jun 4, 2018
1 parent 9089692 commit 999ac07
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docker/pulsar/scripts/watch-znode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -77,7 +80,7 @@ def usage():
usage()
sys.exit(5)

zk = KazooClient(hosts=zookeeper)
zk = KazooClient(hosts=zookeeper, timeout=1, connection_retry=KazooRetry(max_tries=-1))
zk.start()

if create:
Expand Down

0 comments on commit 999ac07

Please sign in to comment.