You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2017/06/28 00:10:13 UTC

kudu git commit: Rename MiniCluster to InternalMiniCluster

Repository: kudu
Updated Branches:
  refs/heads/master 74d67fd2b -> 600d01a5a


Rename MiniCluster to InternalMiniCluster

Since we have ExternalMiniCluster, using InternalMiniCluster as a class
name for the threaded version is consistent. This also opens up the
possibility of using MiniCluster as the base class name in a follow-up
commit.

Change-Id: I7bd326a7a46f039e18c47b8e23ee1427ccf281be
Reviewed-on: http://gerrit.cloudera.org:8080/7272
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <as...@cloudera.com>


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

Branch: refs/heads/master
Commit: 600d01a5a575558a30707eec4a62de40bc5615bb
Parents: 74d67fd
Author: Mike Percy <mp...@apache.org>
Authored: Mon Jun 19 15:00:32 2017 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Wed Jun 28 00:09:20 2017 +0000

----------------------------------------------------------------------
 .../benchmarks/tpch/rpc_line_item_dao-test.cc   |   6 +-
 src/kudu/benchmarks/tpch/tpch1.cc               |   6 +-
 src/kudu/client/client-test.cc                  |   6 +-
 src/kudu/client/predicate-test.cc               |   6 +-
 src/kudu/client/scan_token-test.cc              |   6 +-
 src/kudu/integration-tests/CMakeLists.txt       |   2 +-
 src/kudu/integration-tests/alter_table-test.cc  |   6 +-
 src/kudu/integration-tests/cluster_itest_util.h |   2 +-
 src/kudu/integration-tests/consistency-itest.cc |   4 +-
 .../create-table-stress-test.cc                 |   8 +-
 .../integration-tests/delete_tablet-itest.cc    |   2 +-
 .../integration-tests/external_mini_cluster.h   |   4 +-
 .../full_stack-insert-scan-test.cc              |   6 +-
 src/kudu/integration-tests/fuzz-itest.cc        |   6 +-
 .../internal_mini_cluster-itest-base.h          |  56 +++
 .../integration-tests/internal_mini_cluster.cc  | 348 +++++++++++++++++++
 .../integration-tests/internal_mini_cluster.h   | 192 ++++++++++
 .../master_cert_authority-itest.cc              |   6 +-
 .../master_replication-itest.cc                 |   8 +-
 .../integration-tests/mini_cluster-itest-base.h |  60 ----
 src/kudu/integration-tests/mini_cluster.cc      | 348 -------------------
 src/kudu/integration-tests/mini_cluster.h       | 195 -----------
 src/kudu/integration-tests/mini_cluster_base.h  |   2 +-
 src/kudu/integration-tests/registration-test.cc |   8 +-
 .../security-unknown-tsk-itest.cc               |   8 +-
 .../integration-tests/table_locations-itest.cc  |   6 +-
 .../tablet_history_gc-itest.cc                  |   4 +-
 .../integration-tests/token_signer-itest.cc     |   6 +-
 .../ts_tablet_manager-itest.cc                  |   6 +-
 .../update_scan_delta_compact-test.cc           |   6 +-
 src/kudu/tools/ksck_remote-test.cc              |   8 +-
 src/kudu/tools/kudu-tool-test.cc                |   6 +-
 32 files changed, 668 insertions(+), 675 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc b/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
index 42299eb..b887df7 100644
--- a/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
+++ b/src/kudu/benchmarks/tpch/rpc_line_item_dao-test.cc
@@ -26,7 +26,7 @@
 #include "kudu/benchmarks/tpch/tpch-schemas.h"
 #include "kudu/common/partial_row.h"
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_util.h"
@@ -47,7 +47,7 @@ class RpcLineItemDAOTest : public KuduTest {
     KuduTest::SetUp();
 
     // Start minicluster
-    cluster_.reset(new MiniCluster(env_, MiniClusterOptions()));
+    cluster_.reset(new InternalMiniCluster(env_, MiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
 
     const char *kTableName = "tpch1";
@@ -68,7 +68,7 @@ class RpcLineItemDAOTest : public KuduTest {
   }
 
  protected:
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
   gscoped_ptr<RpcLineItemDAO> dao_;
 
   // Builds a test row to be inserted into the lineitem table.

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/benchmarks/tpch/tpch1.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc
index 7cc95eb..0b0a300 100644
--- a/src/kudu/benchmarks/tpch/tpch1.cc
+++ b/src/kudu/benchmarks/tpch/tpch1.cc
@@ -69,7 +69,7 @@
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/hash/city.h"
 #include "kudu/gutil/strings/numbers.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/util/env.h"
 #include "kudu/util/flags.h"
@@ -246,7 +246,7 @@ int main(int argc, char **argv) {
   kudu::InitGoogleLoggingSafe(argv[0]);
 
   kudu::Env* env;
-  gscoped_ptr<kudu::MiniCluster> cluster;
+  gscoped_ptr<kudu::InternalMiniCluster> cluster;
   string master_address;
   if (FLAGS_use_mini_cluster) {
     env = kudu::Env::Default();
@@ -254,7 +254,7 @@ int main(int argc, char **argv) {
     CHECK(s.IsAlreadyPresent() || s.ok()) << s.ToString();
     kudu::MiniClusterOptions options;
     options.data_root = FLAGS_mini_cluster_base_dir;
-    cluster.reset(new kudu::MiniCluster(env, options));
+    cluster.reset(new kudu::InternalMiniCluster(env, options));
     CHECK_OK(cluster->StartSync());
     master_address = cluster->mini_master()->bound_rpc_addr_str();
   } else {

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/client/client-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index a019f0d..404d1e2 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -47,7 +47,7 @@
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master-test-util.h"
 #include "kudu/master/master.proxy.h"
@@ -140,7 +140,7 @@ class ClientTest : public KuduTest {
     FLAGS_scanner_gc_check_interval_us = 50 * 1000; // 50 milliseconds.
 
     // Start minicluster and wait for tablet servers to connect to master.
-    cluster_.reset(new MiniCluster(env_, MiniClusterOptions()));
+    cluster_.reset(new InternalMiniCluster(env_, MiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
 
     // Connect to the cluster.
@@ -675,7 +675,7 @@ class ClientTest : public KuduTest {
 
   KuduSchema schema_;
 
-  unique_ptr<MiniCluster> cluster_;
+  unique_ptr<InternalMiniCluster> cluster_;
   shared_ptr<KuduClient> client_;
   shared_ptr<KuduTable> client_table_;
 };

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/client/predicate-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/predicate-test.cc b/src/kudu/client/predicate-test.cc
index 44c83b3..a04beb4 100644
--- a/src/kudu/client/predicate-test.cc
+++ b/src/kudu/client/predicate-test.cc
@@ -29,7 +29,7 @@
 #include "kudu/gutil/strings/escaping.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_verifier.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/util/test_util.h"
 
 using std::count_if;
@@ -49,7 +49,7 @@ class PredicateTest : public KuduTest {
 
   void SetUp() override {
     // Set up the mini cluster
-    cluster_.reset(new MiniCluster(env_, MiniClusterOptions()));
+    cluster_.reset(new InternalMiniCluster(env_, MiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
     ASSERT_OK(cluster_->CreateClient(nullptr, &client_));
   }
@@ -459,7 +459,7 @@ class PredicateTest : public KuduTest {
   }
 
   shared_ptr<KuduClient> client_;
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
 };
 
 TEST_F(PredicateTest, TestBoolPredicates) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/client/scan_token-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/scan_token-test.cc b/src/kudu/client/scan_token-test.cc
index 58b62ef..39bd17e 100644
--- a/src/kudu/client/scan_token-test.cc
+++ b/src/kudu/client/scan_token-test.cc
@@ -25,7 +25,7 @@
 #include "kudu/client/client.h"
 #include "kudu/client/client.pb.h"
 #include "kudu/gutil/stl_util.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/tserver/mini_tablet_server.h"
 #include "kudu/tserver/tablet_server.h"
 #include "kudu/util/test_util.h"
@@ -48,7 +48,7 @@ class ScanTokenTest : public KuduTest {
 
   void SetUp() override {
     // Set up the mini cluster
-    cluster_.reset(new MiniCluster(env_, MiniClusterOptions()));
+    cluster_.reset(new InternalMiniCluster(env_, MiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
     ASSERT_OK(cluster_->CreateClient(nullptr, &client_));
   }
@@ -115,7 +115,7 @@ class ScanTokenTest : public KuduTest {
   }
 
   shared_ptr<KuduClient> client_;
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
 };
 
 TEST_F(ScanTokenTest, TestScanTokens) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/CMakeLists.txt b/src/kudu/integration-tests/CMakeLists.txt
index 07b00a1..018f80c 100644
--- a/src/kudu/integration-tests/CMakeLists.txt
+++ b/src/kudu/integration-tests/CMakeLists.txt
@@ -26,8 +26,8 @@ set(INTEGRATION_TESTS_SRCS
   external_mini_cluster-itest-base.cc
   external_mini_cluster.cc
   external_mini_cluster_fs_inspector.cc
+  internal_mini_cluster.cc
   log_verifier.cc
-  mini_cluster.cc
   test_workload.cc
 )
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/alter_table-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/alter_table-test.cc b/src/kudu/integration-tests/alter_table-test.cc
index 334626b..cece524 100644
--- a/src/kudu/integration-tests/alter_table-test.cc
+++ b/src/kudu/integration-tests/alter_table-test.cc
@@ -34,7 +34,7 @@
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/master-test-util.h"
@@ -108,7 +108,7 @@ class AlterTableTest : public KuduTest {
 
     MiniClusterOptions opts;
     opts.num_tablet_servers = num_replicas();
-    cluster_.reset(new MiniCluster(env_, opts));
+    cluster_.reset(new InternalMiniCluster(env_, opts));
     ASSERT_OK(cluster_->Start());
 
     CHECK_OK(KuduClientBuilder()
@@ -250,7 +250,7 @@ class AlterTableTest : public KuduTest {
 
   static const char *kTableName;
 
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
   shared_ptr<KuduClient> client_;
 
   KuduSchema schema_;

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/cluster_itest_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/cluster_itest_util.h b/src/kudu/integration-tests/cluster_itest_util.h
index 481506f..017da70 100644
--- a/src/kudu/integration-tests/cluster_itest_util.h
+++ b/src/kudu/integration-tests/cluster_itest_util.h
@@ -21,7 +21,7 @@
 // primarily through RPC-based APIs or through KuduClient.
 // However, it's also OK to include common operations against a particular
 // cluster type if it's general enough to use from multiple tests while not
-// belonging in the MiniCluster / ExternalMiniCluster classes themselves. But
+// belonging in the InternalMiniCluster / ExternalMiniCluster classes themselves. But
 // consider just putting stuff like that in those classes.
 
 #ifndef KUDU_INTEGRATION_TESTS_CLUSTER_ITEST_UTIL_H_

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/consistency-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/consistency-itest.cc b/src/kudu/integration-tests/consistency-itest.cc
index 901b0d5..561907f 100644
--- a/src/kudu/integration-tests/consistency-itest.cc
+++ b/src/kudu/integration-tests/consistency-itest.cc
@@ -36,8 +36,8 @@
 #include "kudu/master/master.pb.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/mini_cluster-itest-base.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster-itest-base.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/server/hybrid_clock.h"
 #include "kudu/tablet/tablet.h"
 #include "kudu/tablet/tablet_replica.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/create-table-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/create-table-stress-test.cc b/src/kudu/integration-tests/create-table-stress-test.cc
index 4926753..b1a65c9 100644
--- a/src/kudu/integration-tests/create-table-stress-test.cc
+++ b/src/kudu/integration-tests/create-table-stress-test.cc
@@ -26,10 +26,10 @@
 #include "kudu/fs/fs_manager.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
+#include "kudu/master/master-test-util.h"
 #include "kudu/master/master.proxy.h"
 #include "kudu/master/mini_master.h"
-#include "kudu/master/master-test-util.h"
 #include "kudu/rpc/messenger.h"
 #include "kudu/tserver/mini_tablet_server.h"
 #include "kudu/tserver/tablet_server.h"
@@ -88,7 +88,7 @@ class CreateTableStressTest : public KuduTest {
     KuduTest::SetUp();
     MiniClusterOptions opts;
     opts.num_tablet_servers = 3;
-    cluster_.reset(new MiniCluster(env_, opts));
+    cluster_.reset(new InternalMiniCluster(env_, opts));
     ASSERT_OK(cluster_->Start());
 
     ASSERT_OK(KuduClientBuilder()
@@ -113,7 +113,7 @@ class CreateTableStressTest : public KuduTest {
 
  protected:
   client::sp::shared_ptr<KuduClient> client_;
-  unique_ptr<MiniCluster> cluster_;
+  unique_ptr<InternalMiniCluster> cluster_;
   KuduSchema schema_;
   std::shared_ptr<Messenger> messenger_;
   shared_ptr<MasterServiceProxy> master_proxy_;

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/delete_tablet-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/delete_tablet-itest.cc b/src/kudu/integration-tests/delete_tablet-itest.cc
index e306963..b7b2c85 100644
--- a/src/kudu/integration-tests/delete_tablet-itest.cc
+++ b/src/kudu/integration-tests/delete_tablet-itest.cc
@@ -20,7 +20,7 @@
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/mini_cluster-itest-base.h"
+#include "kudu/integration-tests/internal_mini_cluster-itest-base.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/tablet/tablet_replica.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/external_mini_cluster.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.h b/src/kudu/integration-tests/external_mini_cluster.h
index 4484c75..6f4a536 100644
--- a/src/kudu/integration-tests/external_mini_cluster.h
+++ b/src/kudu/integration-tests/external_mini_cluster.h
@@ -131,7 +131,7 @@ struct ExternalMiniClusterOptions {
   // Only used when 'enable_kerberos' is 'true'.
   MiniKdcOptions mini_kdc_options;
 
-  // If true, set up a KDC as part of this MiniCluster, generate keytabs for
+  // If true, set up a KDC as part of this ExternalMiniCluster, generate keytabs for
   // the servers, and require Kerberos authentication from clients.
   //
   // Additionally, when the cluster is started, the environment of the
@@ -151,7 +151,7 @@ struct ExternalMiniClusterOptions {
 // A mini-cluster made up of subprocesses running each of the daemons
 // separately. This is useful for black-box or grey-box failure testing
 // purposes -- it provides the ability to forcibly kill or stop particular
-// cluster participants, which isn't feasible in the normal MiniCluster.
+// cluster participants, which isn't feasible in the normal InternalMiniCluster.
 // On the other hand, there is little access to inspect the internal state
 // of the daemons.
 class ExternalMiniCluster : public MiniClusterBase {

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/full_stack-insert-scan-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/full_stack-insert-scan-test.cc b/src/kudu/integration-tests/full_stack-insert-scan-test.cc
index abd3ea2..23fade6 100644
--- a/src/kudu/integration-tests/full_stack-insert-scan-test.cc
+++ b/src/kudu/integration-tests/full_stack-insert-scan-test.cc
@@ -37,7 +37,7 @@
 #include "kudu/gutil/strings/split.h"
 #include "kudu/gutil/strings/strcat.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/tablet/tablet.h"
 #include "kudu/tablet/tablet_metrics.h"
@@ -163,7 +163,7 @@ class FullStackInsertScanTest : public KuduTest {
 
   void InitCluster() {
     // Start mini-cluster with 1 tserver, config client options
-    cluster_.reset(new MiniCluster(env_, MiniClusterOptions()));
+    cluster_.reset(new InternalMiniCluster(env_, MiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
     KuduClientBuilder builder;
     builder.add_master_server_addr(
@@ -209,7 +209,7 @@ class FullStackInsertScanTest : public KuduTest {
   Random random_;
 
   KuduSchema schema_;
-  std::shared_ptr<MiniCluster> cluster_;
+  std::shared_ptr<InternalMiniCluster> cluster_;
   client::sp::shared_ptr<KuduClient> client_;
   client::sp::shared_ptr<KuduTable> reader_table_;
   // Concurrent client insertion test variables

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/fuzz-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/fuzz-itest.cc b/src/kudu/integration-tests/fuzz-itest.cc
index f68784a..161b291 100644
--- a/src/kudu/integration-tests/fuzz-itest.cc
+++ b/src/kudu/integration-tests/fuzz-itest.cc
@@ -33,7 +33,7 @@
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/master/mini_master.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/server/logical_clock.h"
 #include "kudu/tablet/key_value_test_schema.h"
 #include "kudu/tablet/tablet.h"
@@ -178,7 +178,7 @@ class FuzzTest : public KuduTest {
     KuduTest::SetUp();
 
     MiniClusterOptions opts;
-    cluster_.reset(new MiniCluster(env_, opts));
+    cluster_.reset(new InternalMiniCluster(env_, opts));
     ASSERT_OK(cluster_->Start());
     CHECK_OK(KuduClientBuilder()
              .add_master_server_addr(cluster_->mini_master()->bound_rpc_addr_str())
@@ -425,7 +425,7 @@ class FuzzTest : public KuduTest {
                    int update_multiplier);
 
   KuduSchema schema_;
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
   shared_ptr<KuduClient> client_;
   shared_ptr<KuduSession> session_;
   shared_ptr<KuduTable> table_;

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/internal_mini_cluster-itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/internal_mini_cluster-itest-base.h b/src/kudu/integration-tests/internal_mini_cluster-itest-base.h
new file mode 100644
index 0000000..1cf330c
--- /dev/null
+++ b/src/kudu/integration-tests/internal_mini_cluster-itest-base.h
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+#include "kudu/client/client.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
+#include "kudu/util/test_util.h"
+
+namespace kudu {
+
+// Simple base utility class to provide a mini cluster with common setup
+// routines useful for integration tests.
+class MiniClusterITestBase : public KuduTest {
+ public:
+  virtual void TearDown() OVERRIDE {
+    if (cluster_) {
+      cluster_->Shutdown();
+    }
+    KuduTest::TearDown();
+  }
+
+ protected:
+  void StartCluster(int num_tablet_servers = 3) {
+    MiniClusterOptions opts;
+    opts.num_tablet_servers = num_tablet_servers;
+    cluster_.reset(new InternalMiniCluster(env_, opts));
+    ASSERT_OK(cluster_->Start());
+    ASSERT_OK(cluster_->CreateClient(nullptr, &client_));
+  }
+
+  gscoped_ptr<InternalMiniCluster> cluster_;
+  client::sp::shared_ptr<client::KuduClient> client_;
+};
+
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/internal_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/internal_mini_cluster.cc b/src/kudu/integration-tests/internal_mini_cluster.cc
new file mode 100644
index 0000000..9d7d3ae
--- /dev/null
+++ b/src/kudu/integration-tests/internal_mini_cluster.cc
@@ -0,0 +1,348 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "kudu/integration-tests/internal_mini_cluster.h"
+
+
+#include "kudu/client/client.h"
+#include "kudu/gutil/strings/join.h"
+#include "kudu/gutil/strings/substitute.h"
+#include "kudu/master/catalog_manager.h"
+#include "kudu/master/master.h"
+#include "kudu/master/master.proxy.h"
+#include "kudu/master/mini_master.h"
+#include "kudu/master/ts_descriptor.h"
+#include "kudu/master/ts_manager.h"
+#include "kudu/rpc/messenger.h"
+#include "kudu/tserver/mini_tablet_server.h"
+#include "kudu/tserver/tablet_server.h"
+#include "kudu/util/path_util.h"
+#include "kudu/util/status.h"
+#include "kudu/util/stopwatch.h"
+#include "kudu/util/test_util.h"
+
+using strings::Substitute;
+
+namespace kudu {
+
+using client::KuduClient;
+using client::KuduClientBuilder;
+using master::CatalogManager;
+using master::MasterServiceProxy;
+using master::MiniMaster;
+using master::TSDescriptor;
+using std::shared_ptr;
+using tserver::MiniTabletServer;
+using tserver::TabletServer;
+
+MiniClusterOptions::MiniClusterOptions()
+ :  num_masters(1),
+    num_tablet_servers(1) {
+}
+
+InternalMiniCluster::InternalMiniCluster(Env* env, const MiniClusterOptions& options)
+  : running_(false),
+    env_(env),
+    fs_root_(!options.data_root.empty() ? options.data_root :
+                JoinPathSegments(GetTestDataDirectory(), "minicluster-data")),
+    num_masters_initial_(options.num_masters),
+    num_ts_initial_(options.num_tablet_servers),
+    master_rpc_ports_(options.master_rpc_ports),
+    tserver_rpc_ports_(options.tserver_rpc_ports) {
+}
+
+InternalMiniCluster::~InternalMiniCluster() {
+  Shutdown();
+}
+
+Status InternalMiniCluster::Start() {
+  CHECK(!fs_root_.empty()) << "No Fs root was provided";
+  CHECK(!running_);
+
+  if (num_masters_initial_ > 1) {
+    CHECK_GE(master_rpc_ports_.size(), num_masters_initial_);
+  }
+
+  if (!env_->FileExists(fs_root_)) {
+    RETURN_NOT_OK(env_->CreateDir(fs_root_));
+  }
+
+  // start the masters
+  if (num_masters_initial_ > 1) {
+    RETURN_NOT_OK_PREPEND(StartDistributedMasters(),
+                          "Couldn't start distributed masters");
+  } else {
+    RETURN_NOT_OK_PREPEND(StartSingleMaster(), "Couldn't start the single master");
+  }
+
+  for (int i = 0; i < num_ts_initial_; i++) {
+    RETURN_NOT_OK_PREPEND(AddTabletServer(),
+                          Substitute("Error adding TS $0", i));
+  }
+
+  RETURN_NOT_OK_PREPEND(WaitForTabletServerCount(num_ts_initial_),
+                        "Waiting for tablet servers to start");
+
+  RETURN_NOT_OK_PREPEND(rpc::MessengerBuilder("minicluster-messenger")
+                        .set_num_reactors(1)
+                        .set_max_negotiation_threads(1)
+                        .Build(&messenger_),
+                        "Failed to start Messenger for minicluster");
+
+  running_ = true;
+  return Status::OK();
+}
+
+Status InternalMiniCluster::StartDistributedMasters() {
+  CHECK_GE(master_rpc_ports_.size(), num_masters_initial_);
+  CHECK_GT(master_rpc_ports_.size(), 1);
+
+  LOG(INFO) << "Creating distributed mini masters. Ports: "
+            << JoinInts(master_rpc_ports_, ", ");
+
+  for (int i = 0; i < num_masters_initial_; i++) {
+    gscoped_ptr<MiniMaster> mini_master(
+        new MiniMaster(env_, GetMasterFsRoot(i), master_rpc_ports_[i]));
+    RETURN_NOT_OK_PREPEND(mini_master->StartDistributedMaster(master_rpc_ports_),
+                          Substitute("Couldn't start follower $0", i));
+    VLOG(1) << "Started MiniMaster with UUID " << mini_master->permanent_uuid()
+            << " at index " << i;
+    mini_masters_.push_back(shared_ptr<MiniMaster>(mini_master.release()));
+  }
+  int i = 0;
+  for (const shared_ptr<MiniMaster>& master : mini_masters_) {
+    LOG(INFO) << "Waiting to initialize catalog manager on master " << i++;
+    RETURN_NOT_OK_PREPEND(master->WaitForCatalogManagerInit(),
+                          Substitute("Could not initialize catalog manager on master $0", i));
+  }
+  return Status::OK();
+}
+
+Status InternalMiniCluster::StartSync() {
+  RETURN_NOT_OK(Start());
+  int count = 0;
+  for (const shared_ptr<MiniTabletServer>& tablet_server : mini_tablet_servers_) {
+    RETURN_NOT_OK_PREPEND(tablet_server->WaitStarted(),
+                          Substitute("TabletServer $0 failed to start.", count));
+    count++;
+  }
+  return Status::OK();
+}
+
+Status InternalMiniCluster::StartSingleMaster() {
+  CHECK_EQ(1, num_masters_initial_);
+  CHECK_LE(master_rpc_ports_.size(), 1);
+  uint16_t master_rpc_port = 0;
+  if (master_rpc_ports_.size() == 1) {
+    master_rpc_port = master_rpc_ports_[0];
+  }
+
+  // start the master (we need the port to set on the servers).
+  gscoped_ptr<MiniMaster> mini_master(
+      new MiniMaster(env_, GetMasterFsRoot(0), master_rpc_port));
+  RETURN_NOT_OK_PREPEND(mini_master->Start(), "Couldn't start master");
+  RETURN_NOT_OK(mini_master->master()->WaitUntilCatalogManagerIsLeaderAndReadyForTests(
+      MonoDelta::FromSeconds(kMasterStartupWaitTimeSeconds)));
+  mini_masters_.push_back(shared_ptr<MiniMaster>(mini_master.release()));
+  return Status::OK();
+}
+
+Status InternalMiniCluster::AddTabletServer() {
+  if (mini_masters_.empty()) {
+    return Status::IllegalState("Master not yet initialized");
+  }
+  int new_idx = mini_tablet_servers_.size();
+
+  uint16_t ts_rpc_port = 0;
+  if (tserver_rpc_ports_.size() > new_idx) {
+    ts_rpc_port = tserver_rpc_ports_[new_idx];
+  }
+  gscoped_ptr<MiniTabletServer> tablet_server(
+    new MiniTabletServer(GetTabletServerFsRoot(new_idx), ts_rpc_port));
+
+  // set the master addresses
+  tablet_server->options()->master_addresses.clear();
+  for (const shared_ptr<MiniMaster>& master : mini_masters_) {
+    tablet_server->options()->master_addresses.emplace_back(master->bound_rpc_addr());
+  }
+  RETURN_NOT_OK(tablet_server->Start())
+  mini_tablet_servers_.push_back(shared_ptr<MiniTabletServer>(tablet_server.release()));
+  return Status::OK();
+}
+
+void InternalMiniCluster::ShutdownNodes(ClusterNodes nodes) {
+  if (nodes == ClusterNodes::ALL || nodes == ClusterNodes::TS_ONLY) {
+    for (const shared_ptr<MiniTabletServer>& tablet_server : mini_tablet_servers_) {
+      tablet_server->Shutdown();
+    }
+    mini_tablet_servers_.clear();
+  }
+  if (nodes == ClusterNodes::ALL || nodes == ClusterNodes::MASTERS_ONLY) {
+    for (const shared_ptr<MiniMaster>& master_server : mini_masters_) {
+      master_server->Shutdown();
+    }
+    mini_masters_.clear();
+  }
+  running_ = false;
+}
+
+MiniMaster* InternalMiniCluster::mini_master(int idx) const {
+  CHECK_GE(idx, 0) << "Master idx must be >= 0";
+  CHECK_LT(idx, mini_masters_.size()) << "Master idx must be < num masters started";
+  return mini_masters_[idx].get();
+}
+
+MiniTabletServer* InternalMiniCluster::mini_tablet_server(int idx) const {
+  CHECK_GE(idx, 0) << "TabletServer idx must be >= 0";
+  CHECK_LT(idx, mini_tablet_servers_.size()) << "TabletServer idx must be < 'num_ts_started_'";
+  return mini_tablet_servers_[idx].get();
+}
+
+string InternalMiniCluster::GetMasterFsRoot(int idx) const {
+  return JoinPathSegments(fs_root_, Substitute("master-$0-root", idx));
+}
+
+string InternalMiniCluster::GetTabletServerFsRoot(int idx) const {
+  return JoinPathSegments(fs_root_, Substitute("ts-$0-root", idx));
+}
+
+Status InternalMiniCluster::WaitForTabletServerCount(int count) const {
+  vector<shared_ptr<master::TSDescriptor>> descs;
+  return WaitForTabletServerCount(count, MatchMode::MATCH_TSERVERS, &descs);
+}
+
+Status InternalMiniCluster::WaitForTabletServerCount(int count,
+                                             MatchMode mode,
+                                             vector<shared_ptr<TSDescriptor>>* descs) const {
+  unordered_set<int> masters_to_search;
+  for (int i = 0; i < num_masters(); i++) {
+    if (!mini_master(i)->master()->IsShutdown()) {
+      masters_to_search.insert(i);
+    }
+  }
+
+  Stopwatch sw;
+  sw.start();
+  while (sw.elapsed().wall_seconds() < kRegistrationWaitTimeSeconds) {
+    for (auto iter = masters_to_search.begin(); iter != masters_to_search.end();) {
+      mini_master(*iter)->master()->ts_manager()->GetAllDescriptors(descs);
+      int match_count = 0;
+      switch (mode) {
+        case MatchMode::MATCH_TSERVERS:
+          // GetAllDescriptors() may return servers that are no longer online.
+          // Do a second step of verification to verify that the descs that we got
+          // are aligned (same uuid/seqno) with the TSs that we have in the cluster.
+          for (const shared_ptr<TSDescriptor>& desc : *descs) {
+            for (const auto& mini_tablet_server : mini_tablet_servers_) {
+              const TabletServer* ts = mini_tablet_server->server();
+              if (ts->instance_pb().permanent_uuid() == desc->permanent_uuid() &&
+                  ts->instance_pb().instance_seqno() == desc->latest_seqno()) {
+                match_count++;
+                break;
+              }
+            }
+          }
+          break;
+        case MatchMode::DO_NOT_MATCH_TSERVERS:
+          match_count = descs->size();
+          break;
+        default:
+          LOG(FATAL) << "Invalid match mode";
+      }
+
+      if (match_count == count) {
+        // This master has returned the correct set of tservers.
+        iter = masters_to_search.erase(iter);
+      } else {
+        iter++;
+      }
+    }
+    if (masters_to_search.empty()) {
+      // All masters have returned the correct set of tservers.
+      LOG(INFO) << Substitute("$0 TS(s) registered with all masters after $1s",
+                              count, sw.elapsed().wall_seconds());
+      return Status::OK();
+    }
+    SleepFor(MonoDelta::FromMilliseconds(1));
+  }
+  return Status::TimedOut(Substitute(
+      "Timed out waiting for $0 TS(s) to register with all masters", count));
+}
+
+Status InternalMiniCluster::CreateClient(KuduClientBuilder* builder,
+                                 client::sp::shared_ptr<KuduClient>* client) const {
+  client::KuduClientBuilder defaults;
+  if (builder == nullptr) {
+    builder = &defaults;
+  }
+
+  builder->clear_master_server_addrs();
+  for (const shared_ptr<MiniMaster>& master : mini_masters_) {
+    CHECK(master);
+    builder->add_master_server_addr(master->bound_rpc_addr_str());
+  }
+  return builder->Build(client);
+}
+
+Status InternalMiniCluster::GetLeaderMasterIndex(int* idx) const {
+  const MonoTime deadline = MonoTime::Now() +
+      MonoDelta::FromSeconds(kMasterStartupWaitTimeSeconds);
+
+  int leader_idx = -1;
+  while (MonoTime::Now() < deadline) {
+    for (int i = 0; i < num_masters(); i++) {
+      master::MiniMaster* mm = mini_master(i);
+      if (!mm->is_started() || mm->master()->IsShutdown()) {
+        continue;
+      }
+      master::CatalogManager* catalog = mm->master()->catalog_manager();
+      master::CatalogManager::ScopedLeaderSharedLock l(catalog);
+      if (l.first_failed_status().ok()) {
+        leader_idx = i;
+        break;
+      }
+    }
+    if (leader_idx != -1) {
+      break;
+    }
+    SleepFor(MonoDelta::FromMilliseconds(100));
+  }
+  if (leader_idx == -1) {
+    return Status::NotFound("Leader master was not found within deadline");
+  }
+
+  if (idx) {
+    *idx = leader_idx;
+  }
+  return Status::OK();
+}
+
+std::shared_ptr<rpc::Messenger> InternalMiniCluster::messenger() const {
+  return messenger_;
+}
+
+std::shared_ptr<MasterServiceProxy> InternalMiniCluster::master_proxy() const {
+  CHECK_EQ(1, mini_masters_.size());
+  return master_proxy(0);
+}
+
+std::shared_ptr<MasterServiceProxy> InternalMiniCluster::master_proxy(int idx) const {
+  return std::make_shared<MasterServiceProxy>(
+      messenger_, CHECK_NOTNULL(mini_master(idx))->bound_rpc_addr());
+}
+
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/internal_mini_cluster.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/internal_mini_cluster.h b/src/kudu/integration-tests/internal_mini_cluster.h
new file mode 100644
index 0000000..969a8a2
--- /dev/null
+++ b/src/kudu/integration-tests/internal_mini_cluster.h
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "kudu/client/shared_ptr.h"
+#include "kudu/gutil/macros.h"
+#include "kudu/integration-tests/mini_cluster_base.h"
+#include "kudu/util/env.h"
+
+namespace kudu {
+
+namespace client {
+class KuduClient;
+class KuduClientBuilder;
+}
+
+namespace master {
+class MiniMaster;
+class TSDescriptor;
+class TabletLocationsPB;
+}
+
+namespace tserver {
+class MiniTabletServer;
+}
+
+struct MiniClusterOptions {
+  MiniClusterOptions();
+
+  // Number of master servers.
+  // Default: 1
+  int num_masters;
+
+  // Number of TS to start.
+  // Default: 1
+  int num_tablet_servers;
+
+  // Directory in which to store 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;
+
+  // List of RPC ports for the master to run on.
+  // Defaults to a list 0 (ephemeral ports).
+  std::vector<uint16_t> master_rpc_ports;
+
+  // List of RPC ports for the tservers to run on.
+  // Defaults to a list of 0 (ephemeral ports).
+  std::vector<uint16_t> tserver_rpc_ports;
+};
+
+// An in-process cluster with a MiniMaster and a configurable
+// number of MiniTabletServers for use in tests.
+class InternalMiniCluster : public MiniClusterBase {
+ public:
+  InternalMiniCluster(Env* env, const MiniClusterOptions& options);
+  virtual ~InternalMiniCluster();
+
+  // Start a cluster with a Master and 'num_tablet_servers' TabletServers.
+  // All servers run on the loopback interface with ephemeral ports.
+  Status Start() override;
+
+  // Like the previous method but performs initialization synchronously, i.e.
+  // this will wait for all TS's to be started and initialized. Tests should
+  // use this if they interact with tablets immediately after Start();
+  Status StartSync();
+
+  void ShutdownNodes(ClusterNodes nodes) override;
+
+  // Setup a consensus configuration of distributed masters, with count specified in
+  // 'options'. Requires that a reserve RPC port is specified in
+  // 'options' for each master.
+  Status StartDistributedMasters();
+
+  // Add a new standalone master to the cluster. The new master is started.
+  Status StartSingleMaster();
+
+  // Add a new TS to the cluster. The new TS is started.
+  // Requires that the master is already running.
+  Status AddTabletServer();
+
+  // If this cluster is configured for a single non-distributed
+  // master, return the single master. Exits with a CHECK failure if
+  // there are multiple masters.
+  master::MiniMaster* mini_master() const {
+    CHECK_EQ(mini_masters_.size(), 1);
+    return mini_master(0);
+  }
+
+  // Returns the Master at index 'idx' for this InternalMiniCluster.
+  master::MiniMaster* mini_master(int idx) const;
+
+  // Return number of mini masters.
+  int num_masters() const override {
+    return mini_masters_.size();
+  }
+
+  // Returns the TabletServer at index 'idx' of this InternalMiniCluster.
+  // 'idx' must be between 0 and 'num_tablet_servers' -1.
+  tserver::MiniTabletServer* mini_tablet_server(int idx) const;
+
+  int num_tablet_servers() const override {
+    return mini_tablet_servers_.size();
+  }
+
+  std::string GetMasterFsRoot(int idx) const;
+
+  std::string GetTabletServerFsRoot(int idx) const;
+
+  // Wait until the number of registered tablet servers reaches the given
+  // count on all masters. Returns Status::TimedOut if the desired count is not
+  // achieved within kRegistrationWaitTimeSeconds.
+  enum class MatchMode {
+    // Ensure that the tservers retrieved from each master match up against the
+    // tservers defined in this cluster. The matching is done via
+    // NodeInstancePBs comparisons. If even one match fails, the retrieved
+    // response is considered to be malformed and is retried.
+    //
+    // Note: tservers participate in matching even if they are shut down.
+    MATCH_TSERVERS,
+
+    // Do not perform any matching on the retrieved tservers.
+    DO_NOT_MATCH_TSERVERS,
+  };
+  Status WaitForTabletServerCount(int count) const;
+  Status WaitForTabletServerCount(int count, MatchMode mode,
+                                  std::vector<std::shared_ptr<master::TSDescriptor>>* descs) const;
+
+  Status CreateClient(client::KuduClientBuilder* builder,
+                      client::sp::shared_ptr<client::KuduClient>* client) const override;
+
+  // Determine the leader master of the cluster. Upon successful completion,
+  // sets 'idx' to the leader master's index. The result index index can be used
+  // as an argument for calls to mini_master().
+  //
+  // It's possible to use 'nullptr' instead of providing a valid placeholder
+  // for the result master index. That's for use cases when it's enough
+  // to determine if the cluster has established leader master
+  // without intent to get the actual index.
+  //
+  // Note: if a leader election occurs after this method is executed, the
+  // last result may not be valid.
+  Status GetLeaderMasterIndex(int* idx) const;
+
+  std::shared_ptr<rpc::Messenger> messenger() const override;
+  std::shared_ptr<master::MasterServiceProxy> master_proxy() const override;
+  std::shared_ptr<master::MasterServiceProxy> master_proxy(int idx) const override;
+
+ private:
+  enum {
+    kRegistrationWaitTimeSeconds = 15,
+    kMasterStartupWaitTimeSeconds = 30,
+  };
+
+  bool running_;
+
+  Env* const env_;
+  const std::string fs_root_;
+  const int num_masters_initial_;
+  const int num_ts_initial_;
+
+  const std::vector<uint16_t> master_rpc_ports_;
+  const std::vector<uint16_t> tserver_rpc_ports_;
+
+  std::vector<std::shared_ptr<master::MiniMaster> > mini_masters_;
+  std::vector<std::shared_ptr<tserver::MiniTabletServer> > mini_tablet_servers_;
+
+  std::shared_ptr<rpc::Messenger> messenger_;
+
+  DISALLOW_COPY_AND_ASSIGN(InternalMiniCluster);
+};
+
+} // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/master_cert_authority-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master_cert_authority-itest.cc b/src/kudu/integration-tests/master_cert_authority-itest.cc
index 48331c0..0e650ac 100644
--- a/src/kudu/integration-tests/master_cert_authority-itest.cc
+++ b/src/kudu/integration-tests/master_cert_authority-itest.cc
@@ -21,7 +21,7 @@
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.proxy.h"
@@ -62,7 +62,7 @@ class MasterCertAuthorityTest : public KuduTest {
 
   virtual void SetUp() OVERRIDE {
     KuduTest::SetUp();
-    cluster_.reset(new MiniCluster(env_, opts_));
+    cluster_.reset(new InternalMiniCluster(env_, opts_));
     ASSERT_OK(cluster_->Start());
 
     rpc::MessengerBuilder bld("Client");
@@ -179,7 +179,7 @@ class MasterCertAuthorityTest : public KuduTest {
 
   int num_masters_;
   MiniClusterOptions opts_;
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
 
   shared_ptr<rpc::Messenger> messenger_;
 };

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/master_replication-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master_replication-itest.cc b/src/kudu/integration-tests/master_replication-itest.cc
index 2cfd0e8..02b7625 100644
--- a/src/kudu/integration-tests/master_replication-itest.cc
+++ b/src/kudu/integration-tests/master_replication-itest.cc
@@ -23,7 +23,7 @@
 #include "kudu/client/client.h"
 #include "kudu/common/schema.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.proxy.h"
@@ -67,7 +67,7 @@ class MasterReplicationTest : public KuduTest {
 
   virtual void SetUp() OVERRIDE {
     KuduTest::SetUp();
-    cluster_.reset(new MiniCluster(env_, opts_));
+    cluster_.reset(new InternalMiniCluster(env_, opts_));
     ASSERT_OK(cluster_->Start());
   }
 
@@ -120,7 +120,7 @@ class MasterReplicationTest : public KuduTest {
  protected:
   int num_masters_;
   MiniClusterOptions opts_;
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
 };
 
 // Basic test. Verify that:
@@ -252,7 +252,7 @@ TEST_F(MasterReplicationTest, TestHeartbeatAcceptedByAnyMaster) {
   vector<std::shared_ptr<TSDescriptor>> descs;
   ASSERT_OK(cluster_->WaitForTabletServerCount(
       kNumTabletServerReplicas + 1,
-      MiniCluster::MatchMode::DO_NOT_MATCH_TSERVERS, &descs));
+      InternalMiniCluster::MatchMode::DO_NOT_MATCH_TSERVERS, &descs));
 }
 
 TEST_F(MasterReplicationTest, TestMasterPeerSetsDontMatch) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/mini_cluster-itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster-itest-base.h b/src/kudu/integration-tests/mini_cluster-itest-base.h
deleted file mode 100644
index b62f56a..0000000
--- a/src/kudu/integration-tests/mini_cluster-itest-base.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#ifndef KUDU_INTEGRATION_TESTS_MINI_CLUSTER_ITEST_BASE_H_
-#define KUDU_INTEGRATION_TESTS_MINI_CLUSTER_ITEST_BASE_H_
-
-#include <gtest/gtest.h>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "kudu/client/client.h"
-#include "kudu/integration-tests/mini_cluster.h"
-#include "kudu/util/test_util.h"
-
-namespace kudu {
-
-// Simple base utility class to provide a mini cluster with common setup
-// routines useful for integration tests.
-class MiniClusterITestBase : public KuduTest {
- public:
-  virtual void TearDown() OVERRIDE {
-    if (cluster_) {
-      cluster_->Shutdown();
-    }
-    KuduTest::TearDown();
-  }
-
- protected:
-  void StartCluster(int num_tablet_servers = 3);
-
-  gscoped_ptr<MiniCluster> cluster_;
-  client::sp::shared_ptr<client::KuduClient> client_;
-};
-
-void MiniClusterITestBase::StartCluster(int num_tablet_servers) {
-  MiniClusterOptions opts;
-  opts.num_tablet_servers = num_tablet_servers;
-  cluster_.reset(new MiniCluster(env_, opts));
-  ASSERT_OK(cluster_->Start());
-  ASSERT_OK(cluster_->CreateClient(nullptr, &client_));
-}
-
-} // namespace kudu
-
-#endif // KUDU_INTEGRATION_TESTS_MINI_CLUSTER_ITEST_BASE_H_

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster.cc b/src/kudu/integration-tests/mini_cluster.cc
deleted file mode 100644
index 57d8ea4..0000000
--- a/src/kudu/integration-tests/mini_cluster.cc
+++ /dev/null
@@ -1,348 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#include "kudu/integration-tests/mini_cluster.h"
-
-
-#include "kudu/client/client.h"
-#include "kudu/gutil/strings/join.h"
-#include "kudu/gutil/strings/substitute.h"
-#include "kudu/master/catalog_manager.h"
-#include "kudu/master/master.h"
-#include "kudu/master/master.proxy.h"
-#include "kudu/master/mini_master.h"
-#include "kudu/master/ts_descriptor.h"
-#include "kudu/master/ts_manager.h"
-#include "kudu/rpc/messenger.h"
-#include "kudu/tserver/mini_tablet_server.h"
-#include "kudu/tserver/tablet_server.h"
-#include "kudu/util/path_util.h"
-#include "kudu/util/status.h"
-#include "kudu/util/stopwatch.h"
-#include "kudu/util/test_util.h"
-
-using strings::Substitute;
-
-namespace kudu {
-
-using client::KuduClient;
-using client::KuduClientBuilder;
-using master::CatalogManager;
-using master::MasterServiceProxy;
-using master::MiniMaster;
-using master::TSDescriptor;
-using std::shared_ptr;
-using tserver::MiniTabletServer;
-using tserver::TabletServer;
-
-MiniClusterOptions::MiniClusterOptions()
- :  num_masters(1),
-    num_tablet_servers(1) {
-}
-
-MiniCluster::MiniCluster(Env* env, const MiniClusterOptions& options)
-  : running_(false),
-    env_(env),
-    fs_root_(!options.data_root.empty() ? options.data_root :
-                JoinPathSegments(GetTestDataDirectory(), "minicluster-data")),
-    num_masters_initial_(options.num_masters),
-    num_ts_initial_(options.num_tablet_servers),
-    master_rpc_ports_(options.master_rpc_ports),
-    tserver_rpc_ports_(options.tserver_rpc_ports) {
-}
-
-MiniCluster::~MiniCluster() {
-  Shutdown();
-}
-
-Status MiniCluster::Start() {
-  CHECK(!fs_root_.empty()) << "No Fs root was provided";
-  CHECK(!running_);
-
-  if (num_masters_initial_ > 1) {
-    CHECK_GE(master_rpc_ports_.size(), num_masters_initial_);
-  }
-
-  if (!env_->FileExists(fs_root_)) {
-    RETURN_NOT_OK(env_->CreateDir(fs_root_));
-  }
-
-  // start the masters
-  if (num_masters_initial_ > 1) {
-    RETURN_NOT_OK_PREPEND(StartDistributedMasters(),
-                          "Couldn't start distributed masters");
-  } else {
-    RETURN_NOT_OK_PREPEND(StartSingleMaster(), "Couldn't start the single master");
-  }
-
-  for (int i = 0; i < num_ts_initial_; i++) {
-    RETURN_NOT_OK_PREPEND(AddTabletServer(),
-                          Substitute("Error adding TS $0", i));
-  }
-
-  RETURN_NOT_OK_PREPEND(WaitForTabletServerCount(num_ts_initial_),
-                        "Waiting for tablet servers to start");
-
-  RETURN_NOT_OK_PREPEND(rpc::MessengerBuilder("minicluster-messenger")
-                        .set_num_reactors(1)
-                        .set_max_negotiation_threads(1)
-                        .Build(&messenger_),
-                        "Failed to start Messenger for minicluster");
-
-  running_ = true;
-  return Status::OK();
-}
-
-Status MiniCluster::StartDistributedMasters() {
-  CHECK_GE(master_rpc_ports_.size(), num_masters_initial_);
-  CHECK_GT(master_rpc_ports_.size(), 1);
-
-  LOG(INFO) << "Creating distributed mini masters. Ports: "
-            << JoinInts(master_rpc_ports_, ", ");
-
-  for (int i = 0; i < num_masters_initial_; i++) {
-    gscoped_ptr<MiniMaster> mini_master(
-        new MiniMaster(env_, GetMasterFsRoot(i), master_rpc_ports_[i]));
-    RETURN_NOT_OK_PREPEND(mini_master->StartDistributedMaster(master_rpc_ports_),
-                          Substitute("Couldn't start follower $0", i));
-    VLOG(1) << "Started MiniMaster with UUID " << mini_master->permanent_uuid()
-            << " at index " << i;
-    mini_masters_.push_back(shared_ptr<MiniMaster>(mini_master.release()));
-  }
-  int i = 0;
-  for (const shared_ptr<MiniMaster>& master : mini_masters_) {
-    LOG(INFO) << "Waiting to initialize catalog manager on master " << i++;
-    RETURN_NOT_OK_PREPEND(master->WaitForCatalogManagerInit(),
-                          Substitute("Could not initialize catalog manager on master $0", i));
-  }
-  return Status::OK();
-}
-
-Status MiniCluster::StartSync() {
-  RETURN_NOT_OK(Start());
-  int count = 0;
-  for (const shared_ptr<MiniTabletServer>& tablet_server : mini_tablet_servers_) {
-    RETURN_NOT_OK_PREPEND(tablet_server->WaitStarted(),
-                          Substitute("TabletServer $0 failed to start.", count));
-    count++;
-  }
-  return Status::OK();
-}
-
-Status MiniCluster::StartSingleMaster() {
-  CHECK_EQ(1, num_masters_initial_);
-  CHECK_LE(master_rpc_ports_.size(), 1);
-  uint16_t master_rpc_port = 0;
-  if (master_rpc_ports_.size() == 1) {
-    master_rpc_port = master_rpc_ports_[0];
-  }
-
-  // start the master (we need the port to set on the servers).
-  gscoped_ptr<MiniMaster> mini_master(
-      new MiniMaster(env_, GetMasterFsRoot(0), master_rpc_port));
-  RETURN_NOT_OK_PREPEND(mini_master->Start(), "Couldn't start master");
-  RETURN_NOT_OK(mini_master->master()->WaitUntilCatalogManagerIsLeaderAndReadyForTests(
-      MonoDelta::FromSeconds(kMasterStartupWaitTimeSeconds)));
-  mini_masters_.push_back(shared_ptr<MiniMaster>(mini_master.release()));
-  return Status::OK();
-}
-
-Status MiniCluster::AddTabletServer() {
-  if (mini_masters_.empty()) {
-    return Status::IllegalState("Master not yet initialized");
-  }
-  int new_idx = mini_tablet_servers_.size();
-
-  uint16_t ts_rpc_port = 0;
-  if (tserver_rpc_ports_.size() > new_idx) {
-    ts_rpc_port = tserver_rpc_ports_[new_idx];
-  }
-  gscoped_ptr<MiniTabletServer> tablet_server(
-    new MiniTabletServer(GetTabletServerFsRoot(new_idx), ts_rpc_port));
-
-  // set the master addresses
-  tablet_server->options()->master_addresses.clear();
-  for (const shared_ptr<MiniMaster>& master : mini_masters_) {
-    tablet_server->options()->master_addresses.emplace_back(master->bound_rpc_addr());
-  }
-  RETURN_NOT_OK(tablet_server->Start())
-  mini_tablet_servers_.push_back(shared_ptr<MiniTabletServer>(tablet_server.release()));
-  return Status::OK();
-}
-
-void MiniCluster::ShutdownNodes(ClusterNodes nodes) {
-  if (nodes == ClusterNodes::ALL || nodes == ClusterNodes::TS_ONLY) {
-    for (const shared_ptr<MiniTabletServer>& tablet_server : mini_tablet_servers_) {
-      tablet_server->Shutdown();
-    }
-    mini_tablet_servers_.clear();
-  }
-  if (nodes == ClusterNodes::ALL || nodes == ClusterNodes::MASTERS_ONLY) {
-    for (const shared_ptr<MiniMaster>& master_server : mini_masters_) {
-      master_server->Shutdown();
-    }
-    mini_masters_.clear();
-  }
-  running_ = false;
-}
-
-MiniMaster* MiniCluster::mini_master(int idx) const {
-  CHECK_GE(idx, 0) << "Master idx must be >= 0";
-  CHECK_LT(idx, mini_masters_.size()) << "Master idx must be < num masters started";
-  return mini_masters_[idx].get();
-}
-
-MiniTabletServer* MiniCluster::mini_tablet_server(int idx) const {
-  CHECK_GE(idx, 0) << "TabletServer idx must be >= 0";
-  CHECK_LT(idx, mini_tablet_servers_.size()) << "TabletServer idx must be < 'num_ts_started_'";
-  return mini_tablet_servers_[idx].get();
-}
-
-string MiniCluster::GetMasterFsRoot(int idx) const {
-  return JoinPathSegments(fs_root_, Substitute("master-$0-root", idx));
-}
-
-string MiniCluster::GetTabletServerFsRoot(int idx) const {
-  return JoinPathSegments(fs_root_, Substitute("ts-$0-root", idx));
-}
-
-Status MiniCluster::WaitForTabletServerCount(int count) const {
-  vector<shared_ptr<master::TSDescriptor>> descs;
-  return WaitForTabletServerCount(count, MatchMode::MATCH_TSERVERS, &descs);
-}
-
-Status MiniCluster::WaitForTabletServerCount(int count,
-                                             MatchMode mode,
-                                             vector<shared_ptr<TSDescriptor>>* descs) const {
-  unordered_set<int> masters_to_search;
-  for (int i = 0; i < num_masters(); i++) {
-    if (!mini_master(i)->master()->IsShutdown()) {
-      masters_to_search.insert(i);
-    }
-  }
-
-  Stopwatch sw;
-  sw.start();
-  while (sw.elapsed().wall_seconds() < kRegistrationWaitTimeSeconds) {
-    for (auto iter = masters_to_search.begin(); iter != masters_to_search.end();) {
-      mini_master(*iter)->master()->ts_manager()->GetAllDescriptors(descs);
-      int match_count = 0;
-      switch (mode) {
-        case MatchMode::MATCH_TSERVERS:
-          // GetAllDescriptors() may return servers that are no longer online.
-          // Do a second step of verification to verify that the descs that we got
-          // are aligned (same uuid/seqno) with the TSs that we have in the cluster.
-          for (const shared_ptr<TSDescriptor>& desc : *descs) {
-            for (auto mini_tablet_server : mini_tablet_servers_) {
-              auto ts = mini_tablet_server->server();
-              if (ts->instance_pb().permanent_uuid() == desc->permanent_uuid() &&
-                  ts->instance_pb().instance_seqno() == desc->latest_seqno()) {
-                match_count++;
-                break;
-              }
-            }
-          }
-          break;
-        case MatchMode::DO_NOT_MATCH_TSERVERS:
-          match_count = descs->size();
-          break;
-        default:
-          LOG(FATAL) << "Invalid match mode";
-      }
-
-      if (match_count == count) {
-        // This master has returned the correct set of tservers.
-        iter = masters_to_search.erase(iter);
-      } else {
-        iter++;
-      }
-    }
-    if (masters_to_search.empty()) {
-      // All masters have returned the correct set of tservers.
-      LOG(INFO) << Substitute("$0 TS(s) registered with all masters after $1s",
-                              count, sw.elapsed().wall_seconds());
-      return Status::OK();
-    }
-    SleepFor(MonoDelta::FromMilliseconds(1));
-  }
-  return Status::TimedOut(Substitute(
-      "Timed out waiting for $0 TS(s) to register with all masters", count));
-}
-
-Status MiniCluster::CreateClient(KuduClientBuilder* builder,
-                                 client::sp::shared_ptr<KuduClient>* client) const {
-  client::KuduClientBuilder defaults;
-  if (builder == nullptr) {
-    builder = &defaults;
-  }
-
-  builder->clear_master_server_addrs();
-  for (const shared_ptr<MiniMaster>& master : mini_masters_) {
-    CHECK(master);
-    builder->add_master_server_addr(master->bound_rpc_addr_str());
-  }
-  return builder->Build(client);
-}
-
-Status MiniCluster::GetLeaderMasterIndex(int* idx) const {
-  const MonoTime deadline = MonoTime::Now() +
-      MonoDelta::FromSeconds(kMasterStartupWaitTimeSeconds);
-
-  int leader_idx = -1;
-  while (MonoTime::Now() < deadline) {
-    for (int i = 0; i < num_masters(); i++) {
-      master::MiniMaster* mm = mini_master(i);
-      if (!mm->is_started() || mm->master()->IsShutdown()) {
-        continue;
-      }
-      master::CatalogManager* catalog = mm->master()->catalog_manager();
-      master::CatalogManager::ScopedLeaderSharedLock l(catalog);
-      if (l.first_failed_status().ok()) {
-        leader_idx = i;
-        break;
-      }
-    }
-    if (leader_idx != -1) {
-      break;
-    }
-    SleepFor(MonoDelta::FromMilliseconds(100));
-  }
-  if (leader_idx == -1) {
-    return Status::NotFound("Leader master was not found within deadline");
-  }
-
-  if (idx) {
-    *idx = leader_idx;
-  }
-  return Status::OK();
-}
-
-std::shared_ptr<rpc::Messenger> MiniCluster::messenger() const {
-  return messenger_;
-}
-
-std::shared_ptr<MasterServiceProxy> MiniCluster::master_proxy() const {
-  CHECK_EQ(1, mini_masters_.size());
-  return master_proxy(0);
-}
-
-std::shared_ptr<MasterServiceProxy> MiniCluster::master_proxy(int idx) const {
-  return std::make_shared<MasterServiceProxy>(
-      messenger_, CHECK_NOTNULL(mini_master(idx))->bound_rpc_addr());
-}
-
-} // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/mini_cluster.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster.h b/src/kudu/integration-tests/mini_cluster.h
deleted file mode 100644
index a372e48..0000000
--- a/src/kudu/integration-tests/mini_cluster.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#ifndef KUDU_INTEGRATION_TESTS_MINI_CLUSTER_H
-#define KUDU_INTEGRATION_TESTS_MINI_CLUSTER_H
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "kudu/client/shared_ptr.h"
-#include "kudu/gutil/macros.h"
-#include "kudu/integration-tests/mini_cluster_base.h"
-#include "kudu/util/env.h"
-
-namespace kudu {
-
-namespace client {
-class KuduClient;
-class KuduClientBuilder;
-}
-
-namespace master {
-class MiniMaster;
-class TSDescriptor;
-class TabletLocationsPB;
-}
-
-namespace tserver {
-class MiniTabletServer;
-}
-
-struct MiniClusterOptions {
-  MiniClusterOptions();
-
-  // Number of master servers.
-  // Default: 1
-  int num_masters;
-
-  // Number of TS to start.
-  // Default: 1
-  int num_tablet_servers;
-
-  // Directory in which to store 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;
-
-  // List of RPC ports for the master to run on.
-  // Defaults to a list 0 (ephemeral ports).
-  std::vector<uint16_t> master_rpc_ports;
-
-  // List of RPC ports for the tservers to run on.
-  // Defaults to a list of 0 (ephemeral ports).
-  std::vector<uint16_t> tserver_rpc_ports;
-};
-
-// An in-process cluster with a MiniMaster and a configurable
-// number of MiniTabletServers for use in tests.
-class MiniCluster : public MiniClusterBase {
- public:
-  MiniCluster(Env* env, const MiniClusterOptions& options);
-  virtual ~MiniCluster();
-
-  // Start a cluster with a Master and 'num_tablet_servers' TabletServers.
-  // All servers run on the loopback interface with ephemeral ports.
-  Status Start() override;
-
-  // Like the previous method but performs initialization synchronously, i.e.
-  // this will wait for all TS's to be started and initialized. Tests should
-  // use this if they interact with tablets immediately after Start();
-  Status StartSync();
-
-  void ShutdownNodes(ClusterNodes nodes) override;
-
-  // Setup a consensus configuration of distributed masters, with count specified in
-  // 'options'. Requires that a reserve RPC port is specified in
-  // 'options' for each master.
-  Status StartDistributedMasters();
-
-  // Add a new standalone master to the cluster. The new master is started.
-  Status StartSingleMaster();
-
-  // Add a new TS to the cluster. The new TS is started.
-  // Requires that the master is already running.
-  Status AddTabletServer();
-
-  // If this cluster is configured for a single non-distributed
-  // master, return the single master. Exits with a CHECK failure if
-  // there are multiple masters.
-  master::MiniMaster* mini_master() const {
-    CHECK_EQ(mini_masters_.size(), 1);
-    return mini_master(0);
-  }
-
-  // Returns the Master at index 'idx' for this MiniCluster.
-  master::MiniMaster* mini_master(int idx) const;
-
-  // Return number of mini masters.
-  int num_masters() const override {
-    return mini_masters_.size();
-  }
-
-  // Returns the TabletServer at index 'idx' of this MiniCluster.
-  // 'idx' must be between 0 and 'num_tablet_servers' -1.
-  tserver::MiniTabletServer* mini_tablet_server(int idx) const;
-
-  int num_tablet_servers() const override {
-    return mini_tablet_servers_.size();
-  }
-
-  std::string GetMasterFsRoot(int indx) const;
-
-  std::string GetTabletServerFsRoot(int idx) const;
-
-  // Wait until the number of registered tablet servers reaches the given
-  // count on all masters. Returns Status::TimedOut if the desired count is not
-  // achieved within kRegistrationWaitTimeSeconds.
-  enum class MatchMode {
-    // Ensure that the tservers retrieved from each master match up against the
-    // tservers defined in this cluster. The matching is done via
-    // NodeInstancePBs comparisons. If even one match fails, the retrieved
-    // response is considered to be malformed and is retried.
-    //
-    // Note: tservers participate in matching even if they are shut down.
-    MATCH_TSERVERS,
-
-    // Do not perform any matching on the retrieved tservers.
-    DO_NOT_MATCH_TSERVERS,
-  };
-  Status WaitForTabletServerCount(int count) const;
-  Status WaitForTabletServerCount(int count, MatchMode mode,
-                                  std::vector<std::shared_ptr<master::TSDescriptor>>* descs) const;
-
-  Status CreateClient(client::KuduClientBuilder* builder,
-                      client::sp::shared_ptr<client::KuduClient>* client) const override;
-
-  // Determine the leader master of the cluster. Upon successful completion,
-  // sets 'idx' to the leader master's index. The result index index can be used
-  // as an argument for calls to mini_master().
-  //
-  // It's possible to use 'nullptr' instead of providing a valid placeholder
-  // for the result master index. That's for use cases when it's enough
-  // to determine if the cluster has established leader master
-  // without intent to get the actual index.
-  //
-  // Note: if a leader election occurs after this method is executed, the
-  // last result may not be valid.
-  Status GetLeaderMasterIndex(int* idx) const;
-
-  std::shared_ptr<rpc::Messenger> messenger() const override;
-  std::shared_ptr<master::MasterServiceProxy> master_proxy() const override;
-  std::shared_ptr<master::MasterServiceProxy> master_proxy(int idx) const override;
-
- private:
-  enum {
-    kRegistrationWaitTimeSeconds = 15,
-    kMasterStartupWaitTimeSeconds = 30,
-  };
-
-  bool running_;
-
-  Env* const env_;
-  const std::string fs_root_;
-  const int num_masters_initial_;
-  const int num_ts_initial_;
-
-  const std::vector<uint16_t> master_rpc_ports_;
-  const std::vector<uint16_t> tserver_rpc_ports_;
-
-  std::vector<std::shared_ptr<master::MiniMaster> > mini_masters_;
-  std::vector<std::shared_ptr<tserver::MiniTabletServer> > mini_tablet_servers_;
-
-  std::shared_ptr<rpc::Messenger> messenger_;
-
-  DISALLOW_COPY_AND_ASSIGN(MiniCluster);
-};
-
-} // namespace kudu
-
-#endif /* KUDU_INTEGRATION_TESTS_MINI_CLUSTER_H */

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/mini_cluster_base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/mini_cluster_base.h b/src/kudu/integration-tests/mini_cluster_base.h
index a71b807..6c65506 100644
--- a/src/kudu/integration-tests/mini_cluster_base.h
+++ b/src/kudu/integration-tests/mini_cluster_base.h
@@ -41,7 +41,7 @@ enum class ClusterNodes {
   TS_ONLY
 };
 
-// Base class for MiniCluster implementations. Provides some commonly-used
+// Base class for InternalMiniCluster implementations. Provides some commonly-used
 // virtual methods that allow for abstracting the details of whether the
 // mini-cluster implementation is in-process or out-of-process.
 class MiniClusterBase {

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/registration-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/registration-test.cc b/src/kudu/integration-tests/registration-test.cc
index 71bc0b3..42c73d4 100644
--- a/src/kudu/integration-tests/registration-test.cc
+++ b/src/kudu/integration-tests/registration-test.cc
@@ -28,7 +28,7 @@
 #include "kudu/fs/fs_manager.h"
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/master-test-util.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.pb.h"
@@ -147,7 +147,7 @@ class RegistrationTest : public KuduTest {
 
     KuduTest::SetUp();
 
-    cluster_.reset(new MiniCluster(env_, {}));
+    cluster_.reset(new InternalMiniCluster(env_, {}));
     ASSERT_OK(cluster_->Start());
   }
 
@@ -208,7 +208,7 @@ class RegistrationTest : public KuduTest {
   }
 
  protected:
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
   Schema schema_;
 };
 
@@ -216,7 +216,7 @@ TEST_F(RegistrationTest, TestTSRegisters) {
   // Wait for the TS to register.
   vector<shared_ptr<TSDescriptor> > descs;
   ASSERT_OK(cluster_->WaitForTabletServerCount(
-      1, MiniCluster::MatchMode::MATCH_TSERVERS, &descs));
+      1, InternalMiniCluster::MatchMode::MATCH_TSERVERS, &descs));
   ASSERT_EQ(1, descs.size());
 
   // Verify that the registration is sane.

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/security-unknown-tsk-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/security-unknown-tsk-itest.cc b/src/kudu/integration-tests/security-unknown-tsk-itest.cc
index d537ad9..8cdb3ce 100644
--- a/src/kudu/integration-tests/security-unknown-tsk-itest.cc
+++ b/src/kudu/integration-tests/security-unknown-tsk-itest.cc
@@ -33,7 +33,7 @@
 #include "kudu/client/schema.h"
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/stl_util.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/master/master-test-util.h"
 #include "kudu/master/master.h"
@@ -94,7 +94,7 @@ class SecurityUnknownTskTest : public KuduTest {
     // idle connection to the server and open a new one upon making another call
     // to the same server. This is to force authn token verification at each RPC
     // call: the authn token is verified by the server side during connection
-    // negotiation. This test uses the in-process MiniCluster, this affects Kudu
+    // negotiation. This test uses the in-process InternalMiniCluster, this affects Kudu
     // clients and the server components. In the context of this test, that's
     // crucial only for the Kudu clients used in the tests.
     FLAGS_rpc_reopen_outbound_connections = true;
@@ -105,7 +105,7 @@ class SecurityUnknownTskTest : public KuduTest {
 
     MiniClusterOptions opts;
     opts.num_tablet_servers = num_tablet_servers_;
-    cluster_.reset(new MiniCluster(env_, opts));
+    cluster_.reset(new InternalMiniCluster(env_, opts));
     ASSERT_OK(cluster_->Start());
   }
 
@@ -175,7 +175,7 @@ class SecurityUnknownTskTest : public KuduTest {
   const int num_tablet_servers_;
   const int32_t heartbeat_interval_ms_;
   const KuduSchema schema_;
-  unique_ptr<MiniCluster> cluster_;
+  unique_ptr<InternalMiniCluster> cluster_;
 };
 
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/table_locations-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/table_locations-itest.cc b/src/kudu/integration-tests/table_locations-itest.cc
index 775ba25..104f6e6 100644
--- a/src/kudu/integration-tests/table_locations-itest.cc
+++ b/src/kudu/integration-tests/table_locations-itest.cc
@@ -26,7 +26,7 @@
 #include "kudu/common/schema.h"
 #include "kudu/common/wire_protocol.h"
 #include "kudu/common/wire_protocol.pb.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/master.proxy.h"
 #include "kudu/master/mini_master.h"
@@ -60,7 +60,7 @@ class TableLocationsTest : public KuduTest {
     MiniClusterOptions opts;
     opts.num_tablet_servers = kNumTabletServers;
 
-    cluster_.reset(new MiniCluster(env_, opts));
+    cluster_.reset(new InternalMiniCluster(env_, opts));
     ASSERT_OK(cluster_->Start());
 
     // Create a client proxy to the master.
@@ -84,7 +84,7 @@ class TableLocationsTest : public KuduTest {
                      const vector<pair<KuduPartialRow, KuduPartialRow>>& bounds);
 
   shared_ptr<Messenger> client_messenger_;
-  unique_ptr<MiniCluster> cluster_;
+  unique_ptr<InternalMiniCluster> cluster_;
   unique_ptr<MasterServiceProxy> proxy_;
 };
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/tablet_history_gc-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/tablet_history_gc-itest.cc b/src/kudu/integration-tests/tablet_history_gc-itest.cc
index b17de97..2210cbc 100644
--- a/src/kudu/integration-tests/tablet_history_gc-itest.cc
+++ b/src/kudu/integration-tests/tablet_history_gc-itest.cc
@@ -25,7 +25,7 @@
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster-itest-base.h"
+#include "kudu/integration-tests/internal_mini_cluster-itest-base.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/server/hybrid_clock.h"
 #include "kudu/tablet/local_tablet_writer.h"
@@ -488,7 +488,7 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) {
   // time before reading from them.
   FLAGS_scanner_ttl_ms = 1000 * 60 * 60 * 24;
 
-  StartCluster(1); // Start MiniCluster with a single tablet server.
+  StartCluster(1); // Start InternalMiniCluster with a single tablet server.
   TestWorkload workload(cluster_.get());
   workload.set_num_replicas(1);
   workload.Setup(); // Convenient way to create a table.

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/token_signer-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/token_signer-itest.cc b/src/kudu/integration-tests/token_signer-itest.cc
index 37e829f..8df6145 100644
--- a/src/kudu/integration-tests/token_signer-itest.cc
+++ b/src/kudu/integration-tests/token_signer-itest.cc
@@ -25,7 +25,7 @@
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/catalog_manager.h"
 #include "kudu/master/master.h"
 #include "kudu/master/master.proxy.h"
@@ -75,7 +75,7 @@ class TokenSignerITest : public KuduTest {
 
   void SetUp() override {
     KuduTest::SetUp();
-    cluster_.reset(new MiniCluster(env_, opts_));
+    cluster_.reset(new InternalMiniCluster(env_, opts_));
     ASSERT_OK(cluster_->Start());
   }
 
@@ -130,7 +130,7 @@ class TokenSignerITest : public KuduTest {
   int num_masters_;
   const int num_tablet_servers_ = 3;
   MiniClusterOptions opts_;
-  unique_ptr<MiniCluster> cluster_;
+  unique_ptr<InternalMiniCluster> cluster_;
 };
 
 // Check that once cluster has started, the TSK for signing is available at the

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/ts_tablet_manager-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_tablet_manager-itest.cc b/src/kudu/integration-tests/ts_tablet_manager-itest.cc
index 547fef0..fd089cd 100644
--- a/src/kudu/integration-tests/ts_tablet_manager-itest.cc
+++ b/src/kudu/integration-tests/ts_tablet_manager-itest.cc
@@ -27,7 +27,7 @@
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/integration-tests/cluster_itest_util.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/master.pb.h"
 #include "kudu/master/master.proxy.h"
 #include "kudu/master/mini_master.h"
@@ -84,7 +84,7 @@ class TsTabletManagerITest : public KuduTest {
  protected:
   const KuduSchema schema_;
 
-  gscoped_ptr<MiniCluster> cluster_;
+  gscoped_ptr<InternalMiniCluster> cluster_;
   client::sp::shared_ptr<KuduClient> client_;
   std::shared_ptr<Messenger> client_messenger_;
 };
@@ -97,7 +97,7 @@ void TsTabletManagerITest::SetUp() {
 
   MiniClusterOptions opts;
   opts.num_tablet_servers = kNumReplicas;
-  cluster_.reset(new MiniCluster(env_, opts));
+  cluster_.reset(new InternalMiniCluster(env_, opts));
   ASSERT_OK(cluster_->Start());
   ASSERT_OK(cluster_->CreateClient(nullptr, &client_));
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/integration-tests/update_scan_delta_compact-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/update_scan_delta_compact-test.cc b/src/kudu/integration-tests/update_scan_delta_compact-test.cc
index dbfabf2..e93e7d2 100644
--- a/src/kudu/integration-tests/update_scan_delta_compact-test.cc
+++ b/src/kudu/integration-tests/update_scan_delta_compact-test.cc
@@ -23,7 +23,7 @@
 #include "kudu/client/client.h"
 #include "kudu/client/row_result.h"
 #include "kudu/gutil/strings/strcat.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/tserver/mini_tablet_server.h"
 #include "kudu/util/countdown_latch.h"
@@ -114,7 +114,7 @@ class UpdateScanDeltaCompactionTest : public KuduTest {
 
   void InitCluster() {
     // Start mini-cluster with 1 tserver.
-    cluster_.reset(new MiniCluster(env_, MiniClusterOptions()));
+    cluster_.reset(new InternalMiniCluster(env_, MiniClusterOptions()));
     ASSERT_OK(cluster_->Start());
     KuduClientBuilder client_builder;
     client_builder.add_master_server_addr(
@@ -150,7 +150,7 @@ class UpdateScanDeltaCompactionTest : public KuduTest {
                                   shared_ptr<KuduSession> session);
 
   KuduSchema schema_;
-  std::shared_ptr<MiniCluster> cluster_;
+  std::shared_ptr<InternalMiniCluster> cluster_;
   shared_ptr<KuduTable> table_;
   shared_ptr<KuduClient> client_;
 };

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/src/kudu/tools/ksck_remote-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck_remote-test.cc b/src/kudu/tools/ksck_remote-test.cc
index d57a401..ad34a05 100644
--- a/src/kudu/tools/ksck_remote-test.cc
+++ b/src/kudu/tools/ksck_remote-test.cc
@@ -22,7 +22,7 @@
 
 #include "kudu/client/client.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/master/mini_master.h"
 #include "kudu/tools/data_gen_util.h"
 #include "kudu/tools/ksck_remote.h"
@@ -84,7 +84,7 @@ class RemoteKsckTest : public KuduTest {
 
     opts.num_masters = opts.master_rpc_ports.size();
     opts.num_tablet_servers = 3;
-    mini_cluster_.reset(new MiniCluster(env_, opts));
+    mini_cluster_.reset(new InternalMiniCluster(env_, opts));
     ASSERT_OK(mini_cluster_->Start());
 
     // Connect to the cluster.
@@ -190,8 +190,8 @@ class RemoteKsckTest : public KuduTest {
     return Status::OK();
   }
 
-  std::shared_ptr<MiniCluster> mini_cluster_;
-  std::shared_ptr<Ksck> ksck_;
+  unique_ptr<InternalMiniCluster> mini_cluster_;
+  unique_ptr<Ksck> ksck_;
   shared_ptr<client::KuduClient> client_;
 
   // Captures logged messages from ksck.

http://git-wip-us.apache.org/repos/asf/kudu/blob/600d01a5/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 cc2687c..13b7530 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -53,7 +53,7 @@
 #include "kudu/integration-tests/cluster_itest_util.h"
 #include "kudu/integration-tests/external_mini_cluster.h"
 #include "kudu/integration-tests/external_mini_cluster_fs_inspector.h"
-#include "kudu/integration-tests/mini_cluster.h"
+#include "kudu/integration-tests/internal_mini_cluster.h"
 #include "kudu/integration-tests/test_workload.h"
 #include "kudu/tablet/local_tablet_writer.h"
 #include "kudu/tablet/tablet-harness.h"
@@ -282,7 +282,7 @@ class ToolTest : public KuduTest {
   unique_ptr<ExternalMiniCluster> cluster_;
   unique_ptr<ExternalMiniClusterFsInspector> inspect_;
   unordered_map<string, TServerDetails*> ts_map_;
-  unique_ptr<MiniCluster> mini_cluster_;
+  unique_ptr<InternalMiniCluster> mini_cluster_;
   ExternalMiniClusterOptions cluster_opts_;
   string tool_path_;
 };
@@ -305,7 +305,7 @@ void ToolTest::StartMiniCluster(int num_masters,
   MiniClusterOptions opts;
   opts.num_masters = num_masters;
   opts.num_tablet_servers = num_tablet_servers;
-  mini_cluster_.reset(new MiniCluster(env_, opts));
+  mini_cluster_.reset(new InternalMiniCluster(env_, opts));
   ASSERT_OK(mini_cluster_->Start());
 }