This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 493eb10 [mini_cluster] set MiniChronydOptions::data_root explicitly
493eb10 is described below
commit 493eb10eca9050c42f877049d003c941fcd1f1e8
Author: Alexey Serbin <[email protected]>
AuthorDate: Wed Oct 2 00:14:44 2019 -0700
[mini_cluster] set MiniChronydOptions::data_root explicitly
This patch explicitly sets MiniChronydOptions::data_root when adding
test NTP server to the external mini-cluster. This is necessary to
run the 'test mini_cluster' sub-command of the kudu CLI tool since
the auto-assignment of the 'data_root' field works only when the
mini_cluster is run in the context of a Kudu test.
In addition, this test sets the initial timeout for NTP clock
synchronisation (--ntp_initial_sync_wait_secs) to 10 seconds when
enabling the built-in NTP client. As it turned out, 2 seconds sometimes
was not enough for TSAN builds.
Change-Id: I1103f7048c2782da7167250962ef19df3488c4ba
Reviewed-on: http://gerrit.cloudera.org:8080/14346
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Adar Dembo <[email protected]>
---
src/kudu/mini-cluster/external_mini_cluster.cc | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/kudu/mini-cluster/external_mini_cluster.cc
b/src/kudu/mini-cluster/external_mini_cluster.cc
index 8e77f67..058721e 100644
--- a/src/kudu/mini-cluster/external_mini_cluster.cc
+++ b/src/kudu/mini-cluster/external_mini_cluster.cc
@@ -167,10 +167,19 @@ Status
ExternalMiniCluster::AddNtpFlags(std::vector<std::string>* flags) {
const auto& opt = server->options();
ntp_endpoints.emplace_back(HostPort(opt.bindaddress,
opt.port).ToString());
}
+ // Point the built-in NTP client to the test NTP server running as a part
+ // of the cluster.
flags->emplace_back(Substitute("--builtin_ntp_servers=$0",
JoinStrings(ntp_endpoints, ",")));
+ // The chronyd server supports very short polling interval: let's use this
+ // feature for faster clock synchronisation at startup and to keep the
+ // estimated clock error of the built-in NTP client smaller.
flags->emplace_back(Substitute("--builtin_ntp_poll_interval_ms=100"));
- flags->emplace_back(Substitute("--ntp_initial_sync_wait_secs=2"));
+ // Wait up to 10 seconds to let the built-in NTP client to synchronize its
+ // time with the test NTP server.
+ flags->emplace_back(Substitute("--ntp_initial_sync_wait_secs=10"));
+ // Switch the clock to use the built-in NTP client which clock is
+ // synchronized with the test NTP server.
flags->emplace_back("--time_source=builtin");
}
return Status::OK();
@@ -628,6 +637,8 @@ Status ExternalMiniCluster::AddTabletServer() {
Status ExternalMiniCluster::AddNtpServer(const Sockaddr& addr) {
clock::MiniChronydOptions options;
options.index = ntp_servers_.size();
+ options.data_root = JoinPathSegments(cluster_root(),
+ Substitute("chrony.$0", options.index));
options.bindaddress = addr.host();
options.port = static_cast<uint16_t>(addr.port());
unique_ptr<MiniChronyd> chrony(new MiniChronyd(std::move(options)));