Skip to content

Commit

Permalink
Added Zookeeper timeout config knob in ST
Browse files Browse the repository at this point in the history
Config knob "zk_timeout" for Zookeeper timeout is added in Schema Transformer.
ZookeeperClient now takes in arguemet for zk_timeout for which default has been
set to 400.

Change-Id: Ia1a5569292f4957dba4b3f64aaee997d7db9f9da
Closes-Bug: 1643846
(cherry picked from commit 793fffd)
  • Loading branch information
sahilsabharwal committed Dec 7, 2016
1 parent 90148ab commit ee3b0f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/config/common/zkclient.py
Expand Up @@ -192,7 +192,7 @@ def delete_all(cls, zookeeper_client, path):

class ZookeeperClient(object):

def __init__(self, module, server_list, logging_fn=None):
def __init__(self, module, server_list, logging_fn=None, zk_timeout=400):
# logging
logger = logging.getLogger(module)
logger.setLevel(logging.INFO)
Expand All @@ -213,7 +213,7 @@ def __init__(self, module, server_list, logging_fn=None):
self._zk_client = \
kazoo.client.KazooClient(
server_list,
timeout=400,
timeout=zk_timeout,
handler=kazoo.handlers.gevent.SequentialGeventHandler(),
logger=logger)

Expand Down
9 changes: 7 additions & 2 deletions src/config/schema-transformer/to_bgp.py
Expand Up @@ -3918,6 +3918,7 @@ def parse_args(args_str):
--use_syslog
--syslog_facility LOG_USER
--cluster_id <testbed-name>
--zk_timeout 400
[--reset_config]
'''

Expand Down Expand Up @@ -3953,6 +3954,7 @@ def parse_args(args_str):
'syslog_facility': Sandesh._DEFAULT_SYSLOG_FACILITY,
'cluster_id': '',
'sandesh_send_rate_limit': SandeshSystem.get_sandesh_send_rate_limit(),
'zk_timeout': 400,
}
secopts = {
'use_certs': False,
Expand Down Expand Up @@ -4051,6 +4053,8 @@ def parse_args(args_str):
help="Used for database keyspace separation")
parser.add_argument("--sandesh_send_rate_limit", type=int,
help="Sandesh send rate limit in messages/sec")
parser.add_argument("--zk_timeout",
help="Timeout for ZookeeperClient")
args = parser.parse_args(remaining_argv)
if type(args.cassandra_server_list) is str:
args.cassandra_server_list = args.cassandra_server_list.split()
Expand Down Expand Up @@ -4112,8 +4116,9 @@ def main(args_str=None):
else:
client_pfx = ''
zk_path_pfx = ''
_zookeeper_client = ZookeeperClient(client_pfx+"schema", args.zk_server_ip)
_zookeeper_client.master_election(zk_path_pfx+"/schema-transformer",
_zookeeper_client = ZookeeperClient(client_pfx+"schema", args.zk_server_ip,
zk_timeout =args.zk_timeout)
_zookeeper_client.master_election(zk_path_pfx + "/schema-transformer",
os.getpid(), run_schema_transformer,
args)
# end main
Expand Down

0 comments on commit ee3b0f9

Please sign in to comment.