You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/12/08 02:44:38 UTC

[2/6] mesos git commit: Changed registrar backend to `in_memory` by default in tests.

Changed registrar backend to `in_memory` by default in tests.

Currently, all instances of the Master in tests set the
`--registry` flag to the default value (`replicated_log`).
When the `replicated_log` value is set, Masters in tests will
back the registrar with the disk, specifically via levelDB.

Only a small subset of tests actually require the `replicated_log`;
these are tests which expect the master to persist data across
failovers.  A majority of tests can be run with an `in_memory`
registrar backend.  Changing the default to `in_memory` will
serve multiple purposes:
* It will speed up the test suite by ~10-15%.
* It will reduce the flakiness observed on the ASF CI.
  These machines sometimes run into disk contention, which causes
  registrar reads/write to time out.
* It will unblock a majority of tests from being run on Windows,
  which currently does not implement a persistent registrar backend.

This review supercedes and revives: https://reviews.apache.org/r/41665/

Review: https://reviews.apache.org/r/54453/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1648491e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1648491e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1648491e

Branch: refs/heads/master
Commit: 1648491e2f194f5ba9d62cb1e099066fb7f16272
Parents: 55bcdc4
Author: Alex Clemmer <cl...@gmail.com>
Authored: Wed Dec 7 16:13:22 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Dec 7 18:44:17 2016 -0800

----------------------------------------------------------------------
 src/tests/dynamic_weights_tests.cpp |  2 ++
 src/tests/master_tests.cpp          | 15 +++++++++++++--
 src/tests/mesos.cpp                 |  6 ++++--
 src/tests/partition_tests.cpp       |  1 +
 src/tests/reconciliation_tests.cpp  |  9 +++++++--
 5 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1648491e/src/tests/dynamic_weights_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/dynamic_weights_tests.cpp b/src/tests/dynamic_weights_tests.cpp
index 6f1e249..ce577ce 100644
--- a/src/tests/dynamic_weights_tests.cpp
+++ b/src/tests/dynamic_weights_tests.cpp
@@ -617,6 +617,8 @@ TEST_F(DynamicWeightsTest, RecoveredWeightsFromRegistry)
 {
   // Start a master with `--weights` flag.
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
+
   masterFlags.weights = UPDATED_WEIGHTS1;
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);

http://git-wip-us.apache.org/repos/asf/mesos/blob/1648491e/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index de48594..7442eb8 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -477,7 +477,10 @@ TEST_F(MasterTest, KillUnknownTask)
 
 TEST_F(MasterTest, KillUnknownTaskSlaveInTransition)
 {
-  Try<Owned<cluster::Master>> master = StartMaster();
+  master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
+
+  Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
   Future<SlaveRegisteredMessage> slaveRegisteredMessage =
@@ -546,7 +549,7 @@ TEST_F(MasterTest, KillUnknownTaskSlaveInTransition)
     .WillOnce(FutureSatisfy(&disconnected));
 
   // Restart master.
-  master = StartMaster();
+  master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
   // Intercept the first registrar operation that is attempted; this
@@ -2094,6 +2097,8 @@ TEST_F(MasterTest, RecoveredSlaveCanReregister)
 {
   // Step 1: Start a master.
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -2183,6 +2188,8 @@ TEST_F(MasterTest, UnreachableTaskAfterFailover)
 {
   // Step 1: Start a master.
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -2325,6 +2332,8 @@ TEST_F(MasterTest, RateLimitRecoveredSlaveRemoval)
 {
   // Start a master.
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
@@ -2401,6 +2410,8 @@ TEST_F(MasterTest, CancelRecoveredSlaveRemoval)
 {
   // Start a master.
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
+
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/1648491e/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 8fd8bcb..e9bd2c6 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -143,8 +143,10 @@ master::Flags MesosTest::CreateMasterFlags()
   // Set default ACLs.
   flags.acls = ACLs();
 
-  // Use the replicated log (without ZooKeeper) by default.
-  flags.registry = "replicated_log";
+  // Use the in-memory registry (instead of the replicated log) by default.
+  // TODO(josephw): Consider changing this back to `replicated_log` once
+  // all platforms support this registrar backend.
+  flags.registry = "in_memory";
 
   // On many test VMs, this default is too small.
   flags.registry_store_timeout = flags.registry_store_timeout * 5;

http://git-wip-us.apache.org/repos/asf/mesos/blob/1648491e/src/tests/partition_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/partition_tests.cpp b/src/tests/partition_tests.cpp
index e823672..00cc815 100644
--- a/src/tests/partition_tests.cpp
+++ b/src/tests/partition_tests.cpp
@@ -1659,6 +1659,7 @@ TEST_F(PartitionTest, RegistryGcByCountManySlaves)
   // Configure GC to only keep the most recent partitioned agent in
   // the unreachable list.
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
   masterFlags.registry_max_agent_count = 1;
 
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);

http://git-wip-us.apache.org/repos/asf/mesos/blob/1648491e/src/tests/reconciliation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/reconciliation_tests.cpp b/src/tests/reconciliation_tests.cpp
index 71073a0..aeeb109 100644
--- a/src/tests/reconciliation_tests.cpp
+++ b/src/tests/reconciliation_tests.cpp
@@ -445,7 +445,9 @@ TEST_F(ReconciliationTest, UnknownKillTask)
 TEST_F(ReconciliationTest, RecoveredAgent)
 {
   master::Flags masterFlags = CreateMasterFlags();
-  Try<Owned<cluster::Master>> master = StartMaster();
+  masterFlags.registry = "replicated_log";
+
+  Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
   // Reuse slaveFlags so both StartSlave() use the same work_dir.
@@ -529,7 +531,9 @@ TEST_F(ReconciliationTest, RecoveredAgent)
 TEST_F(ReconciliationTest, RecoveredAgentReregistrationInProgress)
 {
   master::Flags masterFlags = CreateMasterFlags();
-  Try<Owned<cluster::Master>> master = StartMaster();
+  masterFlags.registry = "replicated_log";
+
+  Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);
 
   // Reuse slaveFlags so both StartSlave() use the same work_dir.
@@ -1134,6 +1138,7 @@ TEST_F(ReconciliationTest, ReconcileStatusUpdateTaskState)
 TEST_F(ReconciliationTest, PartitionedAgentThenMasterFailover)
 {
   master::Flags masterFlags = CreateMasterFlags();
+  masterFlags.registry = "replicated_log";
 
   Try<Owned<cluster::Master>> master = StartMaster(masterFlags);
   ASSERT_SOME(master);