You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2017/04/28 22:18:16 UTC

kudu git commit: external mini cluster: pass options by value and move where appropriate

Repository: kudu
Updated Branches:
  refs/heads/master fdc022fe6 -> 401baedf1


external mini cluster: pass options by value and move where appropriate

I also added a default constructor for the few cases where no option
customization is needed (webserver-stress-itest and master_migration-itest).

Change-Id: I75cb8fb7e1c38ffba0ac4894a732c3d54f59da05
Reviewed-on: http://gerrit.cloudera.org:8080/6760
Tested-by: Kudu Jenkins
Reviewed-by: Dan Burkert <da...@apache.org>


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

Branch: refs/heads/master
Commit: 401baedf1586ee99e73478ccfe4618b0c663ced0
Parents: fdc022f
Author: Adar Dembo <ad...@cloudera.com>
Authored: Fri Apr 28 13:37:21 2017 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Fri Apr 28 22:17:00 2017 +0000

----------------------------------------------------------------------
 src/kudu/benchmarks/tpch/tpch_real_world.cc            |  2 +-
 src/kudu/integration-tests/all_types-itest.cc          |  2 +-
 .../integration-tests/alter_table-randomized-test.cc   |  2 +-
 src/kudu/integration-tests/client-stress-test.cc       |  2 +-
 .../integration-tests/external_mini_cluster-test.cc    | 13 +++++++------
 src/kudu/integration-tests/external_mini_cluster.cc    |  8 ++++++--
 src/kudu/integration-tests/external_mini_cluster.h     |  8 +++++++-
 src/kudu/integration-tests/flex_partitioning-itest.cc  |  2 +-
 src/kudu/integration-tests/log-rolling-itest.cc        |  2 +-
 src/kudu/integration-tests/master-stress-test.cc       |  2 +-
 src/kudu/integration-tests/master_migration-itest.cc   |  4 ++--
 src/kudu/integration-tests/open-readonly-fs-itest.cc   |  2 +-
 src/kudu/integration-tests/ts_itest-base.h             |  2 +-
 src/kudu/integration-tests/ts_recovery-itest.cc        |  4 ++--
 src/kudu/integration-tests/version_migration-test.cc   |  2 +-
 src/kudu/integration-tests/webserver-stress-itest.cc   |  3 +--
 16 files changed, 35 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/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 909ae2d..de47fbc 100644
--- a/src/kudu/benchmarks/tpch/tpch_real_world.cc
+++ b/src/kudu/benchmarks/tpch/tpch_real_world.cc
@@ -174,7 +174,7 @@ Status TpchRealWorld::Init() {
       opts.extra_tserver_flags.push_back("--flagfile=" + FLAGS_tpch_path_to_ts_flags_file);
     }
 
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     RETURN_NOT_OK(cluster_->Start());
     master_addresses_ = cluster_->leader_master()->bound_rpc_hostport().ToString();
   } else {

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/all_types-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/all_types-itest.cc b/src/kudu/integration-tests/all_types-itest.cc
index 70d5b9a..50419dc 100644
--- a/src/kudu/integration-tests/all_types-itest.cc
+++ b/src/kudu/integration-tests/all_types-itest.cc
@@ -236,7 +236,7 @@ class AllTypesItest : public KuduTest {
       opts.extra_tserver_flags.push_back(flag);
     }
 
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     RETURN_NOT_OK(cluster_->Start());
     return cluster_->CreateClient(nullptr, &client_);
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/alter_table-randomized-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/alter_table-randomized-test.cc b/src/kudu/integration-tests/alter_table-randomized-test.cc
index 5387e9c..7edf0b2 100644
--- a/src/kudu/integration-tests/alter_table-randomized-test.cc
+++ b/src/kudu/integration-tests/alter_table-randomized-test.cc
@@ -72,7 +72,7 @@ class AlterTableRandomized : public KuduTest {
     // This test produces tables with lots of columns. With container preallocation,
     // we end up using quite a bit of disk space. So, we disable it.
     opts.extra_tserver_flags.push_back("--log_container_preallocate_bytes=0");
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
 
     ASSERT_OK(cluster_->CreateClient(nullptr, &client_));

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/client-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client-stress-test.cc b/src/kudu/integration-tests/client-stress-test.cc
index 3c1a1f4..43cc2da 100644
--- a/src/kudu/integration-tests/client-stress-test.cc
+++ b/src/kudu/integration-tests/client-stress-test.cc
@@ -56,7 +56,7 @@ class ClientStressTest : public KuduTest {
       opts.master_rpc_ports = { 11010, 11011, 11012 };
     }
     opts.num_tablet_servers = 3;
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/external_mini_cluster-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster-test.cc b/src/kudu/integration-tests/external_mini_cluster-test.cc
index 56fa7f3..fb8eaed 100644
--- a/src/kudu/integration-tests/external_mini_cluster-test.cc
+++ b/src/kudu/integration-tests/external_mini_cluster-test.cc
@@ -51,10 +51,11 @@ INSTANTIATE_TEST_CASE_P(KerberosOnAndOff,
                         ExternalMiniClusterTest,
                         ::testing::Values(WITHOUT_KERBEROS, WITH_KERBEROS));
 
-void SmokeTestKerberizedCluster(const ExternalMiniClusterOptions& opts) {
+void SmokeTestKerberizedCluster(ExternalMiniClusterOptions opts) {
   ASSERT_TRUE(opts.enable_kerberos);
+  int num_tservers = opts.num_tablet_servers;
 
-  ExternalMiniCluster cluster(opts);
+  ExternalMiniCluster cluster(std::move(opts));
   ASSERT_OK(cluster.Start());
 
   // Sleep long enough to ensure that the tserver's ticket would have expired
@@ -70,7 +71,7 @@ void SmokeTestKerberizedCluster(const ExternalMiniClusterOptions& opts) {
   cluster.master(0)->Shutdown();
   ASSERT_OK(cluster.master(0)->Restart());
   // Ensure that all of the tablet servers can register with the masters.
-  ASSERT_OK(cluster.WaitForTabletServerCount(opts.num_tablet_servers, MonoDelta::FromSeconds(30)));
+  ASSERT_OK(cluster.WaitForTabletServerCount(num_tservers, MonoDelta::FromSeconds(30)));
   cluster.Shutdown();
 }
 
@@ -83,7 +84,7 @@ TEST_F(ExternalMiniClusterTest, TestKerberosRenewal) {
   opts.mini_kdc_options.ticket_lifetime = "15s";
   opts.num_tablet_servers = 1;
 
-  SmokeTestKerberizedCluster(opts);
+  SmokeTestKerberizedCluster(std::move(opts));
 }
 
 TEST_F(ExternalMiniClusterTest, TestKerberosReacquire) {
@@ -97,7 +98,7 @@ TEST_F(ExternalMiniClusterTest, TestKerberosReacquire) {
   opts.mini_kdc_options.renew_lifetime = "15s";
   opts.num_tablet_servers = 1;
 
-  SmokeTestKerberizedCluster(opts);
+  SmokeTestKerberizedCluster(std::move(opts));
 }
 
 TEST_P(ExternalMiniClusterTest, TestBasicOperation) {
@@ -111,7 +112,7 @@ TEST_P(ExternalMiniClusterTest, TestBasicOperation) {
   opts.num_masters = opts.master_rpc_ports.size();
   opts.num_tablet_servers = 3;
 
-  ExternalMiniCluster cluster(opts);
+  ExternalMiniCluster cluster(std::move(opts));
   ASSERT_OK(cluster.Start());
 
   // Verify each of the masters.

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.cc b/src/kudu/integration-tests/external_mini_cluster.cc
index 6fff7f1..72bae63 100644
--- a/src/kudu/integration-tests/external_mini_cluster.cc
+++ b/src/kudu/integration-tests/external_mini_cluster.cc
@@ -97,8 +97,12 @@ ExternalMiniClusterOptions::ExternalMiniClusterOptions()
 ExternalMiniClusterOptions::~ExternalMiniClusterOptions() {
 }
 
-ExternalMiniCluster::ExternalMiniCluster(const ExternalMiniClusterOptions& opts)
-  : opts_(opts) {
+ExternalMiniCluster::ExternalMiniCluster()
+  : opts_(ExternalMiniClusterOptions()) {
+}
+
+ExternalMiniCluster::ExternalMiniCluster(ExternalMiniClusterOptions opts)
+  : opts_(std::move(opts)) {
 }
 
 ExternalMiniCluster::~ExternalMiniCluster() {

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/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 d460a84..b910d35 100644
--- a/src/kudu/integration-tests/external_mini_cluster.h
+++ b/src/kudu/integration-tests/external_mini_cluster.h
@@ -146,7 +146,13 @@ struct ExternalMiniClusterOptions {
 // of the daemons.
 class ExternalMiniCluster : public MiniClusterBase {
  public:
-  explicit ExternalMiniCluster(const ExternalMiniClusterOptions& opts);
+  // Constructs a cluster with the default options.
+  ExternalMiniCluster();
+
+  // Constructs a cluster with options specified in 'opts'.
+  explicit ExternalMiniCluster(ExternalMiniClusterOptions opts);
+
+  // Destroys a cluster.
   virtual ~ExternalMiniCluster();
 
   // Start the cluster.

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/flex_partitioning-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/flex_partitioning-itest.cc b/src/kudu/integration-tests/flex_partitioning-itest.cc
index 69c20ab..32daa2b 100644
--- a/src/kudu/integration-tests/flex_partitioning-itest.cc
+++ b/src/kudu/integration-tests/flex_partitioning-itest.cc
@@ -160,7 +160,7 @@ class FlexPartitioningITest : public KuduTest,
     // we end up using quite a bit of disk space. So, we disable them.
     opts.extra_tserver_flags.push_back("--log_container_preallocate_bytes=0");
     opts.extra_tserver_flags.push_back("--log_preallocate_segments=false");
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
 
     ASSERT_OK(cluster_->CreateClient(nullptr, &client_));

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/log-rolling-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/log-rolling-itest.cc b/src/kudu/integration-tests/log-rolling-itest.cc
index 10d59ee..37e7f4c 100644
--- a/src/kudu/integration-tests/log-rolling-itest.cc
+++ b/src/kudu/integration-tests/log-rolling-itest.cc
@@ -49,7 +49,7 @@ TEST(LogRollingITest, TestLogCleanupOnStartup) {
   opts.num_tablet_servers = 0;
   opts.extra_master_flags = { "--max_log_files=3", };
   opts.logtostderr = false;
-  ExternalMiniCluster cluster(opts);
+  ExternalMiniCluster cluster(std::move(opts));
   ASSERT_OK(cluster.Start());
 
   // Explicitly wait for the catalog manager because we've got no tservers in

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/master-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master-stress-test.cc b/src/kudu/integration-tests/master-stress-test.cc
index b99ea5e..1c13054 100644
--- a/src/kudu/integration-tests/master-stress-test.cc
+++ b/src/kudu/integration-tests/master-stress-test.cc
@@ -114,7 +114,7 @@ class MasterStressTest : public KuduTest {
     // again (down from 1 second).
     opts.extra_tserver_flags.push_back("--heartbeat_interval_ms=500");
 
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
     KuduClientBuilder builder;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/master_migration-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master_migration-itest.cc b/src/kudu/integration-tests/master_migration-itest.cc
index 84b6a9e..d3fed08 100644
--- a/src/kudu/integration-tests/master_migration-itest.cc
+++ b/src/kudu/integration-tests/master_migration-itest.cc
@@ -68,7 +68,7 @@ class MasterMigrationTest : public KuduTest {
     if (cluster_) {
       cluster_->Shutdown();
     }
-    cluster_.reset(new ExternalMiniCluster(ExternalMiniClusterOptions()));
+    cluster_.reset(new ExternalMiniCluster());
     ASSERT_OK(cluster_->Start());
   }
 
@@ -185,7 +185,7 @@ TEST_F(MasterMigrationTest, TestEndToEndMigration) {
   ExternalMiniClusterOptions opts;
   opts.master_rpc_ports = kMasterRpcPorts;
   opts.num_masters = kMasterRpcPorts.size();
-  ExternalMiniCluster migrated_cluster(opts);
+  ExternalMiniCluster migrated_cluster(std::move(opts));
   ASSERT_OK(migrated_cluster.Start());
 
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/open-readonly-fs-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/open-readonly-fs-itest.cc b/src/kudu/integration-tests/open-readonly-fs-itest.cc
index d07f311..68e7ba0 100644
--- a/src/kudu/integration-tests/open-readonly-fs-itest.cc
+++ b/src/kudu/integration-tests/open-readonly-fs-itest.cc
@@ -63,7 +63,7 @@ class OpenReadonlyFsITest : public KuduTest {
     opts.extra_tserver_flags.push_back("--maintenance_manager_num_threads=16");
     opts.extra_tserver_flags.push_back("--flush_threshold_mb=1");
 
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
 
     ASSERT_OK(cluster_->CreateClient(nullptr, &client_));

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/ts_itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_itest-base.h b/src/kudu/integration-tests/ts_itest-base.h
index 3655977..3a88ed1 100644
--- a/src/kudu/integration-tests/ts_itest-base.h
+++ b/src/kudu/integration-tests/ts_itest-base.h
@@ -118,7 +118,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
     AddExtraFlags(FLAGS_ts_flags, &opts.extra_tserver_flags);
     AddExtraFlags(FLAGS_master_flags, &opts.extra_master_flags);
 
-    cluster_.reset(new ExternalMiniCluster(opts));
+    cluster_.reset(new ExternalMiniCluster(std::move(opts)));
     ASSERT_OK(cluster_->Start());
     inspect_.reset(new itest::ExternalMiniClusterFsInspector(cluster_.get()));
     CreateTSProxies();

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/ts_recovery-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_recovery-itest.cc b/src/kudu/integration-tests/ts_recovery-itest.cc
index a79a531..1b60be1 100644
--- a/src/kudu/integration-tests/ts_recovery-itest.cc
+++ b/src/kudu/integration-tests/ts_recovery-itest.cc
@@ -84,7 +84,7 @@ void TsRecoveryITest::StartCluster(const vector<string>& extra_tserver_flags,
   ExternalMiniClusterOptions opts;
   opts.num_tablet_servers = num_tablet_servers;
   opts.extra_tserver_flags = extra_tserver_flags;
-  cluster_.reset(new ExternalMiniCluster(opts));
+  cluster_.reset(new ExternalMiniCluster(std::move(opts)));
   ASSERT_OK(cluster_->Start());
 }
 
@@ -525,7 +525,7 @@ TEST_P(Kudu969Test, Test) {
   // concurrency bugs where a compaction and a flush might be happening
   // at the same time during the crash.
   opts.extra_tserver_flags.push_back("--maintenance_manager_num_threads=3");
-  cluster_.reset(new ExternalMiniCluster(opts));
+  cluster_.reset(new ExternalMiniCluster(std::move(opts)));
   ASSERT_OK(cluster_->Start());
 
   // Set a small flush threshold so that we flush a lot (causing more compactions

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/version_migration-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/version_migration-test.cc b/src/kudu/integration-tests/version_migration-test.cc
index 87876f0..a31eed8 100644
--- a/src/kudu/integration-tests/version_migration-test.cc
+++ b/src/kudu/integration-tests/version_migration-test.cc
@@ -82,7 +82,7 @@ void VersionMigrationTest::StartCluster(const vector<string>& extra_ts_flags,
   opts.extra_master_flags.push_back("--undefok=unlock_experimental_flags,unlock_unsafe_flags");
   opts.extra_tserver_flags = extra_ts_flags;
   opts.extra_tserver_flags.push_back("--undefok=unlock_experimental_flags,unlock_unsafe_flags");
-  cluster_.reset(new ExternalMiniCluster(opts));
+  cluster_.reset(new ExternalMiniCluster(std::move(opts)));
   verifier_.reset(new LogVerifier(cluster_.get()));
   ASSERT_OK(cluster_->Start());
   ASSERT_OK(cluster_->CreateClient(nullptr, &client_));

http://git-wip-us.apache.org/repos/asf/kudu/blob/401baedf/src/kudu/integration-tests/webserver-stress-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/webserver-stress-itest.cc b/src/kudu/integration-tests/webserver-stress-itest.cc
index a473d02..8c6cd92 100644
--- a/src/kudu/integration-tests/webserver-stress-itest.cc
+++ b/src/kudu/integration-tests/webserver-stress-itest.cc
@@ -44,8 +44,7 @@ TEST_F(KuduTest, TestWebUIDoesNotCrashCluster) {
 #endif
   const int kNumTablets = 50;
 
-  ExternalMiniClusterOptions opts;
-  ExternalMiniCluster cluster(opts);
+  ExternalMiniCluster cluster;
   ASSERT_OK(cluster.Start());
 
   // Start pounding the master and tserver's web UIs.