kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [1/2] kudu git commit: mini-cluster: rename data_root to cluster_root
Date Wed, 17 Jan 2018 03:19:19 GMT
Repository: kudu
Updated Branches:
  refs/heads/master b0d27d3f5 -> c40e0587b


mini-cluster: rename data_root to cluster_root

I found that the name data_root for the root directory in which to place
the cluster's data and logs was a confusing name because:
  1. we use "data" here loosely to describe any old bytes, encompassing
     not only data blocks, but WALs and logs as well, and
  2. the concept of a "data root" already exists to mean a
     user-specified location to place data blocks (i.e. an entry in
     fs_data_dirs).

As such, this patch renames External- and InternalMiniClusterOptions'
"data_root" members to "cluster_root".

Change-Id: Id8ccc9e232f47a684d6b9226fd84639c4c94d0c3
Reviewed-on: http://gerrit.cloudera.org:8080/9033
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Andrew Wong <awong@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/5806b807
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/5806b807
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/5806b807

Branch: refs/heads/master
Commit: 5806b807a712116e79e8a67dc4dcc55d51ea6b2a
Parents: b0d27d3
Author: Andrew Wong <anjuwong@g.ucla.edu>
Authored: Tue Jan 16 08:44:24 2018 -0800
Committer: Andrew Wong <awong@cloudera.com>
Committed: Wed Jan 17 01:06:54 2018 +0000

----------------------------------------------------------------------
 src/kudu/benchmarks/tpch/tpch1.cc              |  2 +-
 src/kudu/benchmarks/tpch/tpch_real_world.cc    |  2 +-
 src/kudu/integration-tests/ts_itest-base.cc    |  4 ++--
 src/kudu/mini-cluster/external_mini_cluster.cc | 22 ++++++++++-----------
 src/kudu/mini-cluster/external_mini_cluster.h  | 10 +++++-----
 src/kudu/mini-cluster/internal_mini_cluster.cc | 14 ++++++-------
 src/kudu/mini-cluster/internal_mini_cluster.h  |  4 ++--
 src/kudu/tools/kudu-tool-test.cc               |  4 ++--
 src/kudu/tools/tool.proto                      |  2 +-
 src/kudu/tools/tool_action_test.cc             | 20 +++++++++----------
 10 files changed, 42 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/benchmarks/tpch/tpch1.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc
index d8d4a11..2feb823 100644
--- a/src/kudu/benchmarks/tpch/tpch1.cc
+++ b/src/kudu/benchmarks/tpch/tpch1.cc
@@ -261,7 +261,7 @@ int main(int argc, char **argv) {
     kudu::Status s = env->CreateDir(FLAGS_mini_cluster_base_dir);
     CHECK(s.IsAlreadyPresent() || s.ok()) << s.ToString();
     kudu::cluster::InternalMiniClusterOptions options;
-    options.data_root = FLAGS_mini_cluster_base_dir;
+    options.cluster_root = FLAGS_mini_cluster_base_dir;
     cluster.reset(new kudu::cluster::InternalMiniCluster(env, options));
     CHECK_OK(cluster->StartSync());
     master_address = cluster->mini_master()->bound_rpc_addr_str();

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/benchmarks/tpch/tpch_real_world.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch_real_world.cc b/src/kudu/benchmarks/tpch/tpch_real_world.cc
index ce65501..03a25f1 100644
--- a/src/kudu/benchmarks/tpch/tpch_real_world.cc
+++ b/src/kudu/benchmarks/tpch/tpch_real_world.cc
@@ -194,7 +194,7 @@ Status TpchRealWorld::Init() {
 
     ExternalMiniClusterOptions opts;
     opts.num_tablet_servers = 1;
-    opts.data_root = FLAGS_tpch_mini_cluster_base_dir;
+    opts.cluster_root = FLAGS_tpch_mini_cluster_base_dir;
     if (!FLAGS_tpch_path_to_ts_flags_file.empty()) {
       opts.extra_tserver_flags.push_back("--flagfile=" + FLAGS_tpch_path_to_ts_flags_file);
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/integration-tests/ts_itest-base.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_itest-base.cc b/src/kudu/integration-tests/ts_itest-base.cc
index f8344f0..26f4010 100644
--- a/src/kudu/integration-tests/ts_itest-base.cc
+++ b/src/kudu/integration-tests/ts_itest-base.cc
@@ -105,7 +105,7 @@ void TabletServerIntegrationTestBase::AddExtraFlags(
 }
 
 void TabletServerIntegrationTestBase::CreateCluster(
-    const string& data_root_path,
+    const string& cluster_root_path,
     const vector<string>& non_default_ts_flags,
     const vector<string>& non_default_master_flags,
     uint32_t num_data_dirs) {
@@ -118,7 +118,7 @@ void TabletServerIntegrationTestBase::CreateCluster(
 
   cluster::ExternalMiniClusterOptions opts;
   opts.num_tablet_servers = FLAGS_num_tablet_servers;
-  opts.data_root = GetTestPath(data_root_path);
+  opts.cluster_root = GetTestPath(cluster_root_path);
   opts.num_data_dirs = num_data_dirs;
 
   // Enable exactly once semantics for tests.

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/mini-cluster/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/mini-cluster/external_mini_cluster.cc b/src/kudu/mini-cluster/external_mini_cluster.cc
index 1495b7b..df5cb12 100644
--- a/src/kudu/mini-cluster/external_mini_cluster.cc
+++ b/src/kudu/mini-cluster/external_mini_cluster.cc
@@ -132,9 +132,9 @@ Status ExternalMiniCluster::HandleOptions() {
     RETURN_NOT_OK(DeduceBinRoot(&opts_.daemon_bin_path));
   }
 
-  if (opts_.data_root.empty()) {
-    // If they don't specify a data root, use the current gtest directory.
-    opts_.data_root = JoinPathSegments(GetTestDataDirectory(), "minicluster-data");
+  if (opts_.cluster_root.empty()) {
+    // If they don't specify a cluster root, use the current gtest directory.
+    opts_.cluster_root = JoinPathSegments(GetTestDataDirectory(), "minicluster-data");
   }
 
   if (opts_.block_manager_type.empty()) {
@@ -157,9 +157,9 @@ Status ExternalMiniCluster::Start() {
                         .Build(&messenger_),
                         "Failed to start Messenger for minicluster");
 
-  Status s = Env::Default()->CreateDir(opts_.data_root);
+  Status s = Env::Default()->CreateDir(opts_.cluster_root);
   if (!s.ok() && !s.IsAlreadyPresent()) {
-    RETURN_NOT_OK_PREPEND(s, "Could not create root dir " + opts_.data_root);
+    RETURN_NOT_OK_PREPEND(s, "Could not create root dir " + opts_.cluster_root);
   }
 
   if (opts_.enable_kerberos) {
@@ -258,13 +258,13 @@ string ExternalMiniCluster::GetBinaryPath(const string& binary)
const {
 }
 
 string ExternalMiniCluster::GetLogPath(const string& daemon_id) const {
-  CHECK(!opts_.data_root.empty());
-  return JoinPathSegments(JoinPathSegments(opts_.data_root, daemon_id), "logs");
+  CHECK(!opts_.cluster_root.empty());
+  return JoinPathSegments(JoinPathSegments(opts_.cluster_root, daemon_id), "logs");
 }
 
 string ExternalMiniCluster::GetDataPath(const string& daemon_id,
                                         boost::optional<uint32_t> dir_index) const
{
-  CHECK(!opts_.data_root.empty());
+  CHECK(!opts_.cluster_root.empty());
   string data_path = "data";
   if (dir_index) {
     CHECK_LT(*dir_index, opts_.num_data_dirs);
@@ -272,7 +272,7 @@ string ExternalMiniCluster::GetDataPath(const string& daemon_id,
   } else {
     CHECK_EQ(1, opts_.num_data_dirs);
   }
-  return JoinPathSegments(JoinPathSegments(opts_.data_root, daemon_id), data_path);
+  return JoinPathSegments(JoinPathSegments(opts_.cluster_root, daemon_id), data_path);
 }
 
 vector<string> ExternalMiniCluster::GetDataPaths(const string& daemon_id) const
{
@@ -287,8 +287,8 @@ vector<string> ExternalMiniCluster::GetDataPaths(const string&
daemon_id) const
 }
 
 string ExternalMiniCluster::GetWalPath(const string& daemon_id) const {
-  CHECK(!opts_.data_root.empty());
-  return JoinPathSegments(JoinPathSegments(opts_.data_root, daemon_id), "wal");
+  CHECK(!opts_.cluster_root.empty());
+  return JoinPathSegments(JoinPathSegments(opts_.cluster_root, daemon_id), "wal");
 }
 
 namespace {

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/mini-cluster/external_mini_cluster.h
----------------------------------------------------------------------
diff --git a/src/kudu/mini-cluster/external_mini_cluster.h b/src/kudu/mini-cluster/external_mini_cluster.h
index 0d19bff..17c7c3a 100644
--- a/src/kudu/mini-cluster/external_mini_cluster.h
+++ b/src/kudu/mini-cluster/external_mini_cluster.h
@@ -87,10 +87,10 @@ struct ExternalMiniClusterOptions {
   // Default: 1.
   int num_tablet_servers;
 
-  // Directory in which to store data.
+  // Directory in which to store the cluster's data.
   //
   // Default: "", which auto-generates a unique path for this cluster.
-  std::string data_root;
+  std::string cluster_root;
 
   // Block manager type. Must be either "file" or "log".
   //
@@ -247,8 +247,8 @@ class ExternalMiniCluster : public MiniCluster {
     return hms_.get();
   }
 
-  const std::string& data_root() const {
-    return opts_.data_root;
+  const std::string& cluster_root() const {
+    return opts_.cluster_root;
   }
 
   int num_tablet_servers() const override {
@@ -322,7 +322,7 @@ class ExternalMiniCluster : public MiniCluster {
   std::string GetBinaryPath(const std::string& binary) const;
 
   // Returns the path where 'daemon_id' is expected to store its data, based on
-  // ExternalMiniClusterOptions.data_root if it was provided, or on the
+  // ExternalMiniClusterOptions.cluster_root if it was provided, or on the
   // standard Kudu test directory otherwise.
   // 'dir_index' is an optional numeric suffix to be added to the default path.
   // If it is not specified, the cluster must be configured to use a single data dir.

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/mini-cluster/internal_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/mini-cluster/internal_mini_cluster.cc b/src/kudu/mini-cluster/internal_mini_cluster.cc
index cfd0474..7e342cc 100644
--- a/src/kudu/mini-cluster/internal_mini_cluster.cc
+++ b/src/kudu/mini-cluster/internal_mini_cluster.cc
@@ -73,8 +73,8 @@ InternalMiniCluster::InternalMiniCluster(Env* env, InternalMiniClusterOptions
op
   : env_(env),
     opts_(std::move(options)),
     running_(false) {
-  if (opts_.data_root.empty()) {
-    opts_.data_root = JoinPathSegments(GetTestDataDirectory(), "minicluster-data");
+  if (opts_.cluster_root.empty()) {
+    opts_.cluster_root = JoinPathSegments(GetTestDataDirectory(), "minicluster-data");
   }
 }
 
@@ -83,15 +83,15 @@ InternalMiniCluster::~InternalMiniCluster() {
 }
 
 Status InternalMiniCluster::Start() {
-  CHECK(!opts_.data_root.empty()) << "No Fs root was provided";
+  CHECK(!opts_.cluster_root.empty()) << "No cluster root was provided";
   CHECK(!running_);
 
   if (opts_.num_masters > 1) {
     CHECK_GE(opts_.master_rpc_ports.size(), opts_.num_masters);
   }
 
-  if (!env_->FileExists(opts_.data_root)) {
-    RETURN_NOT_OK(env_->CreateDir(opts_.data_root));
+  if (!env_->FileExists(opts_.cluster_root)) {
+    RETURN_NOT_OK(env_->CreateDir(opts_.cluster_root));
   }
 
   // start the masters
@@ -264,11 +264,11 @@ vector<HostPort> InternalMiniCluster::master_rpc_addrs() const
{
 }
 
 string InternalMiniCluster::GetMasterFsRoot(int idx) const {
-  return JoinPathSegments(opts_.data_root, Substitute("master-$0-root", idx));
+  return JoinPathSegments(opts_.cluster_root, Substitute("master-$0-root", idx));
 }
 
 string InternalMiniCluster::GetTabletServerFsRoot(int idx) const {
-  return JoinPathSegments(opts_.data_root, Substitute("ts-$0-root", idx));
+  return JoinPathSegments(opts_.cluster_root, Substitute("ts-$0-root", idx));
 }
 
 Status InternalMiniCluster::WaitForTabletServerCount(int count) const {

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/mini-cluster/internal_mini_cluster.h
----------------------------------------------------------------------
diff --git a/src/kudu/mini-cluster/internal_mini_cluster.h b/src/kudu/mini-cluster/internal_mini_cluster.h
index d1e55de..4f73505 100644
--- a/src/kudu/mini-cluster/internal_mini_cluster.h
+++ b/src/kudu/mini-cluster/internal_mini_cluster.h
@@ -70,10 +70,10 @@ struct InternalMiniClusterOptions {
   // Default: 1 (this will place the wals in the same dir)
   int num_data_dirs;
 
-  // Directory in which to store data.
+  // Directory in which to store the cluster's data.
   // Default: "", which auto-generates a unique path for this cluster.
   // The default may only be used from a gtest unit test.
-  std::string data_root;
+  std::string cluster_root;
 
   MiniCluster::BindMode bind_mode;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/tools/kudu-tool-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index 0f1a939..2798898 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -1910,7 +1910,7 @@ TEST_P(ControlShellToolTest, TestControlShell) {
   {
     ControlShellRequestPB req;
     ControlShellResponsePB resp;
-    req.mutable_create_cluster()->set_data_root(JoinPathSegments(
+    req.mutable_create_cluster()->set_cluster_root(JoinPathSegments(
         test_dir_, "minicluster-data"));
     req.mutable_create_cluster()->set_num_masters(kNumMasters);
     req.mutable_create_cluster()->set_num_tservers(kNumTservers);
@@ -1922,7 +1922,7 @@ TEST_P(ControlShellToolTest, TestControlShell) {
   {
     ControlShellRequestPB req;
     ControlShellResponsePB resp;
-    req.mutable_create_cluster()->set_data_root(JoinPathSegments(
+    req.mutable_create_cluster()->set_cluster_root(JoinPathSegments(
         test_dir_, "minicluster-data"));
     ASSERT_OK(proto_->SendMessage(req));
     ASSERT_OK(proto_->ReceiveMessage(&resp));

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/tools/tool.proto
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool.proto b/src/kudu/tools/tool.proto
index 1c1e5a3..c591925 100644
--- a/src/kudu/tools/tool.proto
+++ b/src/kudu/tools/tool.proto
@@ -44,7 +44,7 @@ message CreateClusterRequestPB {
   optional bool enable_hive_metastore = 7;
 
   // The directory where the cluster's data and logs should be placed.
-  optional string data_root = 4;
+  optional string cluster_root = 4;
 
   // Any additional gflags for masters or tablet servers. Each should be in a
   // a format that's expected by gflag (i.e. "--foo=bar").

http://git-wip-us.apache.org/repos/asf/kudu/blob/5806b807/src/kudu/tools/tool_action_test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_test.cc b/src/kudu/tools/tool_action_test.cc
index 5e01ae9..c5fc888 100644
--- a/src/kudu/tools/tool_action_test.cc
+++ b/src/kudu/tools/tool_action_test.cc
@@ -68,8 +68,8 @@ using strings::Substitute;
 
 namespace {
 
-Status MakeDataRoot(string* data_root) {
-  // The ExternalMiniCluster can't generate the data root on our behalf because
+Status MakeClusterRoot(string* cluster_root) {
+  // The ExternalMiniCluster can't generate the cluster root on our behalf because
   // we're not running inside a gtest. So we'll use this approach instead,
   // which is what the Java external mini cluster used for a long time.
   const char* tmpdir = getenv("TEST_TMPDIR");
@@ -77,7 +77,7 @@ Status MakeDataRoot(string* data_root) {
   string root = JoinPathSegments(tmpdir_str, "minicluster-data");
   RETURN_NOT_OK(env_util::CreateDirsRecursively(Env::Default(), root));
 
-  *data_root = root;
+  *cluster_root = root;
   return Status::OK();
 }
 
@@ -158,10 +158,10 @@ Status ProcessRequest(const ControlShellRequestPB& req,
       }
       opts.enable_kerberos = cc.enable_kerberos();
       opts.enable_hive_metastore = cc.enable_hive_metastore();
-      if (cc.has_data_root()) {
-        opts.data_root = cc.data_root();
+      if (cc.has_cluster_root()) {
+        opts.cluster_root = cc.cluster_root();
       } else {
-        RETURN_NOT_OK(MakeDataRoot(&opts.data_root));
+        RETURN_NOT_OK(MakeClusterRoot(&opts.cluster_root));
       }
       opts.extra_master_flags.assign(cc.extra_master_flags().begin(),
                                      cc.extra_master_flags().end());
@@ -171,7 +171,7 @@ Status ProcessRequest(const ControlShellRequestPB& req,
         opts.master_rpc_ports = { 11030, 11031, 11032 };
       }
       if (opts.enable_kerberos) {
-        opts.mini_kdc_options.data_root = JoinPathSegments(opts.data_root, "krb5kdc");
+        opts.mini_kdc_options.data_root = JoinPathSegments(opts.cluster_root, "krb5kdc");
       }
 
       cluster->reset(new ExternalMiniCluster(std::move(opts)));
@@ -344,11 +344,11 @@ Status RunControlShell(const RunnerContext& /*context*/) {
     RETURN_NOT_OK(s);
   }
 
-  // Normal exit, clean up data root.
+  // Normal exit, clean up cluster root.
   if (cluster) {
     cluster->Shutdown();
-    WARN_NOT_OK(Env::Default()->DeleteRecursively(cluster->data_root()),
-                "Could not delete data root");
+    WARN_NOT_OK(Env::Default()->DeleteRecursively(cluster->cluster_root()),
+                "Could not delete cluster root");
   }
   return Status::OK();
 }


Mime
View raw message