You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/10/14 18:30:58 UTC

mesos git commit: Replaced a hard-coded number for registration backoff with a proper constant.

Repository: mesos
Updated Branches:
  refs/heads/master 01ca009af -> beb67a21c


Replaced a hard-coded number for registration backoff with a proper constant.

Prepends a constant regulating the backoff factor with a DEFAULT\_ prefix for clarity and uses it in tests where appropriate and extends comments for
posterity.

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


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

Branch: refs/heads/master
Commit: beb67a21c006f00a8bf86596087dcf70930b3a33
Parents: 01ca009
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Wed Oct 14 17:58:09 2015 +0200
Committer: Bernd Mathiske <be...@mesosphere.io>
Committed: Wed Oct 14 17:58:09 2015 +0200

----------------------------------------------------------------------
 src/sched/constants.cpp             |  2 +-
 src/sched/constants.hpp             |  2 +-
 src/sched/flags.hpp                 |  2 +-
 src/slave/constants.cpp             |  2 +-
 src/slave/constants.hpp             |  2 +-
 src/slave/flags.cpp                 |  2 +-
 src/tests/fault_tolerance_tests.cpp | 10 ++++++----
 7 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/sched/constants.cpp
----------------------------------------------------------------------
diff --git a/src/sched/constants.cpp b/src/sched/constants.cpp
index 517ca5c..ff0abb6 100644
--- a/src/sched/constants.cpp
+++ b/src/sched/constants.cpp
@@ -27,7 +27,7 @@ namespace scheduler {
 // do an initial backoff for the very first attempt unlike the slave.
 // TODO(vinod): Once we fix the scheduler driver to do initial backoff
 // we can change the default to 1s.
-const Duration REGISTRATION_BACKOFF_FACTOR = Seconds(2);
+const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(2);
 
 const Duration REGISTRATION_RETRY_INTERVAL_MAX = Minutes(1);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/sched/constants.hpp
----------------------------------------------------------------------
diff --git a/src/sched/constants.hpp b/src/sched/constants.hpp
index ac497b2..d6c545c 100644
--- a/src/sched/constants.hpp
+++ b/src/sched/constants.hpp
@@ -27,7 +27,7 @@ namespace scheduler {
 
 // Default backoff interval used by the scheduler driver to wait
 // before registration.
-extern const Duration REGISTRATION_BACKOFF_FACTOR;
+extern const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR;
 
 // The maximum interval the scheduler driver waits before retrying
 // registration.

http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/sched/flags.hpp
----------------------------------------------------------------------
diff --git a/src/sched/flags.hpp b/src/sched/flags.hpp
index 4e0d56f..fcd06e2 100644
--- a/src/sched/flags.hpp
+++ b/src/sched/flags.hpp
@@ -46,7 +46,7 @@ public:
         "3rd retry between [0, b * 2^2]...) up to a maximum of (framework\n"
         "failover timeout/10, if failover timeout is specified) or " +
         stringify(REGISTRATION_RETRY_INTERVAL_MAX) + ", whichever is smaller",
-        REGISTRATION_BACKOFF_FACTOR);
+        DEFAULT_REGISTRATION_BACKOFF_FACTOR);
 
     // This help message for --modules flag is the same for
     // {master,slave,tests,sched}/flags.hpp and should always be kept

http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/slave/constants.cpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.cpp b/src/slave/constants.cpp
index 96dadce..b69471b 100644
--- a/src/slave/constants.cpp
+++ b/src/slave/constants.cpp
@@ -32,7 +32,7 @@ const Duration EXECUTOR_REREGISTER_TIMEOUT = Seconds(2);
 const Duration EXECUTOR_SIGNAL_ESCALATION_TIMEOUT = Seconds(3);
 const Duration STATUS_UPDATE_RETRY_INTERVAL_MIN = Seconds(10);
 const Duration STATUS_UPDATE_RETRY_INTERVAL_MAX = Minutes(10);
-const Duration REGISTRATION_BACKOFF_FACTOR = Seconds(1);
+const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(1);
 const Duration REGISTER_RETRY_INTERVAL_MAX = Minutes(1);
 const Duration GC_DELAY = Weeks(1);
 const double GC_DISK_HEADROOM = 0.1;

http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index 1197268..de6b58a 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -48,7 +48,7 @@ extern const Duration GC_DELAY;
 extern const Duration DISK_WATCH_INTERVAL;
 
 // Default backoff interval used by the slave to wait before registration.
-extern const Duration REGISTRATION_BACKOFF_FACTOR;
+extern const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR;
 
 // The maximum interval the slave waits before retrying registration.
 // Note that this value has to be << 'MIN_SLAVE_REREGISTER_TIMEOUT'

http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index ac68e1b..1bf394e 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -178,7 +178,7 @@ mesos::internal::slave::Flags::Flags()
       "2nd retry between [0, b * 2^2], 3rd retry between [0, b * 2^3] etc)\n"
       "up to a maximum of " +
         stringify(REGISTER_RETRY_INTERVAL_MAX),
-      REGISTRATION_BACKOFF_FACTOR);
+      DEFAULT_REGISTRATION_BACKOFF_FACTOR);
 
   add(&Flags::executor_environment_variables,
       "executor_environment_variables",

http://git-wip-us.apache.org/repos/asf/mesos/blob/beb67a21/src/tests/fault_tolerance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fault_tolerance_tests.cpp b/src/tests/fault_tolerance_tests.cpp
index c97bc46..41f23cf 100644
--- a/src/tests/fault_tolerance_tests.cpp
+++ b/src/tests/fault_tolerance_tests.cpp
@@ -646,8 +646,8 @@ TEST_F(FaultToleranceTest, SchedulerFailoverRetriedReregistration)
 
   AWAIT_READY(reregistrationMessage);
 
-  // Trigger the re-registration retry.
-  Clock::advance(internal::scheduler::REGISTRATION_BACKOFF_FACTOR);
+  // Trigger the re-registration retry instantly to avoid blocking the test.
+  Clock::advance(internal::scheduler::DEFAULT_REGISTRATION_BACKOFF_FACTOR);
 
   AWAIT_READY(sched2Registered);
 
@@ -700,8 +700,9 @@ TEST_F(FaultToleranceTest, FrameworkReliableRegistration)
 
   AWAIT_READY(frameworkRegisteredMessage);
 
+  // Trigger the re-registration retry instantly to avoid blocking the test.
   Clock::pause();
-  Clock::advance(internal::scheduler::REGISTRATION_BACKOFF_FACTOR);
+  Clock::advance(internal::scheduler::DEFAULT_REGISTRATION_BACKOFF_FACTOR);
 
   AWAIT_READY(registered); // Ensures registered message is received.
 
@@ -1561,8 +1562,9 @@ TEST_F(FaultToleranceTest, SlaveReliableRegistration)
 
   AWAIT_READY(slaveRegisteredMessage);
 
+  // Trigger the registration retry instantly to avoid blocking the test.
   Clock::pause();
-  Clock::advance(Seconds(1)); // TODO(benh): Pull out constant from Slave.
+  Clock::advance(internal::slave::DEFAULT_REGISTRATION_BACKOFF_FACTOR);
 
   AWAIT_READY(resourceOffers);