Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add zookeeper client config resolve_delay_ms #1100

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/rdsn/src/zookeeper/zookeeper_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ int zookeeper_session::attach(void *callback_owner, const state_callback &cb)
}
dassert(_handle != nullptr, "zookeeper session init failed");
}
int ret = zoo_set_servers_resolution_delay(
_handle, zookeeper_session_mgr::instance().resolve_delay_ms());
dassert(ret == ZOK, "zookeeper set resolve_delay_ms failed.");

_watchers.push_back(watcher_object());
_watchers.back().watcher_path = "";
Expand Down
2 changes: 2 additions & 0 deletions src/rdsn/src/zookeeper/zookeeper_session_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ zookeeper_session_mgr::zookeeper_session_mgr()
_timeout_ms = dsn_config_get_value_uint64(
"zookeeper", "timeout_ms", 30000, "zookeeper_timeout_milliseconds");
_zoo_logfile = dsn_config_get_value_string("zookeeper", "logfile", "", "zookeeper logfile");
_resolve_delay_ms = dsn_config_get_value_uint64(
"zookeeper", "resolve_delay_ms", 0, "zookeeper_resolve_delay_ms");

FILE *fp = fopen(_zoo_logfile.c_str(), "a");
if (fp != nullptr)
Expand Down
2 changes: 2 additions & 0 deletions src/rdsn/src/zookeeper/zookeeper_session_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class zookeeper_session_mgr : public utils::singleton<zookeeper_session_mgr>
const char *zoo_hosts() const { return _zoo_hosts.c_str(); }
int timeout() const { return _timeout_ms; }
const char *zoo_logfile() const { return _zoo_logfile.c_str(); }
int resolve_delay_ms() const { return _resolve_delay_ms; }

private:
zookeeper_session_mgr();
Expand All @@ -59,6 +60,7 @@ class zookeeper_session_mgr : public utils::singleton<zookeeper_session_mgr>
std::string _zoo_hosts;
int _timeout_ms;
std::string _zoo_logfile;
int _resolve_delay_ms;

friend class utils::singleton<zookeeper_session_mgr>;
};
Expand Down
1 change: 1 addition & 0 deletions src/server/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
hosts_list = %{zk.server.list}
timeout_ms = 10000
logfile = zoo.log
resolve_delay_ms = 0

[task..default]
is_trace = false
Expand Down