You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/03/12 03:55:29 UTC

[1/7] mesos git commit: Made `Bytes` usable in `constexpr` expressions.

Repository: mesos
Updated Branches:
  refs/heads/master 24ce5bcbc -> da45261f5


Made `Bytes` usable in `constexpr` expressions.

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


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

Branch: refs/heads/master
Commit: b27366f3ff844176e6462f308a23e32da6f5e419
Parents: 24ce5bc
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:07:38 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:07:38 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/bytes.hpp      | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b27366f3/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp
index 88a8bd4..9debe2f 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/bytes.hpp
@@ -67,8 +67,8 @@ public:
     return Error("Invalid bytes '" + s + "'");
   }
 
-  Bytes(uint64_t bytes = 0) : value(bytes) {}
-  Bytes(uint64_t _value, uint64_t _unit) : value(_value * _unit) {}
+  constexpr Bytes(uint64_t bytes = 0) : value(bytes) {}
+  constexpr Bytes(uint64_t _value, uint64_t _unit) : value(_value * _unit) {}
 
   // TODO(bmahler): Consider killing kilobytes to terabyte helpers, given
   // they implicitly lose precision if not careful.
@@ -120,11 +120,11 @@ public:
   }
 
 protected:
-  static const uint64_t BYTES = 1;
-  static const uint64_t KILOBYTES = 1024 * BYTES;
-  static const uint64_t MEGABYTES = 1024 * KILOBYTES;
-  static const uint64_t GIGABYTES = 1024 * MEGABYTES;
-  static const uint64_t TERABYTES = 1024 * GIGABYTES;
+  static constexpr uint64_t BYTES = 1;
+  static constexpr uint64_t KILOBYTES = 1024 * BYTES;
+  static constexpr uint64_t MEGABYTES = 1024 * KILOBYTES;
+  static constexpr uint64_t GIGABYTES = 1024 * MEGABYTES;
+  static constexpr uint64_t TERABYTES = 1024 * GIGABYTES;
 
 private:
   uint64_t value;
@@ -134,28 +134,28 @@ private:
 class Kilobytes : public Bytes
 {
 public:
-  explicit Kilobytes(uint64_t value) : Bytes(value, KILOBYTES) {}
+  explicit constexpr Kilobytes(uint64_t value) : Bytes(value, KILOBYTES) {}
 };
 
 
 class Megabytes : public Bytes
 {
 public:
-  explicit Megabytes(uint64_t value) : Bytes(value, MEGABYTES) {}
+  explicit constexpr Megabytes(uint64_t value) : Bytes(value, MEGABYTES) {}
 };
 
 
 class Gigabytes : public Bytes
 {
 public:
-  explicit Gigabytes(uint64_t value) : Bytes(value, GIGABYTES) {}
+  explicit constexpr Gigabytes(uint64_t value) : Bytes(value, GIGABYTES) {}
 };
 
 
 class Terabytes : public Bytes
 {
 public:
-  explicit Terabytes(uint64_t value) : Bytes(value, TERABYTES) {}
+  explicit constexpr Terabytes(uint64_t value) : Bytes(value, TERABYTES) {}
 };
 
 


[3/7] mesos git commit: Avoided external linkage for master constants.

Posted by bm...@apache.org.
Avoided external linkage for master constants.

We were only using external linkage to workaround bugs in ancient
(4.1.x) of GCC. We can also mark most of these constants `constexpr`
to bring this up-to-date with the latest style guidelines.

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


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

Branch: refs/heads/master
Commit: 83001de38e7d08cae7baef3b63f80ec7688db875
Parents: 6ce23f8
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:11:48 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:15:22 2016 -0800

----------------------------------------------------------------------
 src/CMakeLists.txt       |  1 -
 src/Makefile.am          |  1 -
 src/master/constants.cpp | 55 -------------------------------------------
 src/master/constants.hpp | 51 +++++++++++++++++----------------------
 4 files changed, 22 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/83001de3/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bfd2141..a41d3cc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -197,7 +197,6 @@ set(LOGGING_SRC
 
 set(MASTER_SRC
   master/contender.cpp
-  master/constants.cpp
   master/detector.cpp
   master/flags.cpp
   master/http.cpp

http://git-wip-us.apache.org/repos/asf/mesos/blob/83001de3/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 70c32f0..5157b15 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -621,7 +621,6 @@ libmesos_no_3rdparty_la_SOURCES +=					\
   local/local.cpp							\
   logging/flags.cpp							\
   logging/logging.cpp							\
-  master/constants.cpp							\
   master/contender.cpp							\
   master/detector.cpp							\
   master/flags.cpp							\

http://git-wip-us.apache.org/repos/asf/mesos/blob/83001de3/src/master/constants.cpp
----------------------------------------------------------------------
diff --git a/src/master/constants.cpp b/src/master/constants.cpp
deleted file mode 100644
index e316f97..0000000
--- a/src/master/constants.cpp
+++ /dev/null
@@ -1,55 +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 <stdint.h>
-
-#include <string>
-
-#include <stout/bytes.hpp>
-
-#include "master/constants.hpp"
-
-namespace mesos {
-namespace internal {
-namespace master {
-
-const int MAX_OFFERS_PER_FRAMEWORK = 50;
-const double MIN_CPUS = 0.01;
-const Bytes MIN_MEM = Megabytes(32);
-const Duration DEFAULT_HEARTBEAT_INTERVAL = Seconds(15);
-const Duration DEFAULT_SLAVE_PING_TIMEOUT = Seconds(15);
-const size_t DEFAULT_MAX_SLAVE_PING_TIMEOUTS = 5;
-const Duration MIN_SLAVE_REREGISTER_TIMEOUT = Minutes(10);
-const double RECOVERY_SLAVE_REMOVAL_PERCENT_LIMIT = 1.0; // 100%.
-const size_t MAX_REMOVED_SLAVES = 100000;
-const size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS = 50;
-const size_t DEFAULT_MAX_COMPLETED_TASKS_PER_FRAMEWORK = 1000;
-const Duration WHITELIST_WATCH_INTERVAL = Seconds(5);
-const uint32_t TASK_LIMIT = 100;
-const std::string MASTER_INFO_LABEL = "info";
-const std::string MASTER_INFO_JSON_LABEL = "json.info";
-
-const Duration ZOOKEEPER_SESSION_TIMEOUT = Seconds(10);
-const std::string DEFAULT_AUTHENTICATOR = "crammd5";
-const std::string DEFAULT_ALLOCATOR = "HierarchicalDRF";
-const Duration DEFAULT_ALLOCATION_INTERVAL = Seconds(1);
-const std::string DEFAULT_AUTHORIZER = "local";
-const std::string DEFAULT_HTTP_AUTHENTICATOR = "basic";
-const std::string DEFAULT_HTTP_AUTHENTICATION_REALM = "mesos";
-
-} // namespace master {
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/83001de3/src/master/constants.hpp
----------------------------------------------------------------------
diff --git a/src/master/constants.hpp b/src/master/constants.hpp
index 2c3299b..f87c2d5 100644
--- a/src/master/constants.hpp
+++ b/src/master/constants.hpp
@@ -31,12 +31,6 @@ namespace master {
 // TODO(benh): Add units after constants.
 // TODO(benh): Also make configuration options be constants.
 
-// TODO(bmahler): It appears there may be a bug with gcc-4.1.2 in which the
-// duration constants were not being initialized when having static linkage.
-// This issue did not manifest in newer gcc's. Specifically, 4.2.1 was ok.
-// So we've moved these to have external linkage but perhaps in the future
-// we can revert this.
-
 // TODO(vinod): Move constants that are only used in flags to
 // 'master/flags.hpp'.
 
@@ -44,18 +38,17 @@ namespace master {
 // details in MESOS-1023.
 
 // Maximum number of slot offers to have outstanding for each framework.
-extern const int MAX_OFFERS_PER_FRAMEWORK;
+constexpr int MAX_OFFERS_PER_FRAMEWORK = 50;
 
 // Minimum number of cpus per offer.
-extern const double MIN_CPUS;
+constexpr double MIN_CPUS = 0.01;
 
 // Minimum amount of memory per offer.
-extern const Bytes MIN_MEM;
-
+constexpr Bytes MIN_MEM = Megabytes(32);
 
 // Default interval the master uses to send heartbeats to an HTTP
 // scheduler.
-extern const Duration DEFAULT_HEARTBEAT_INTERVAL;
+constexpr Duration DEFAULT_HEARTBEAT_INTERVAL = Seconds(15);
 
 // Amount of time within which a slave PING should be received.
 // NOTE: The slave uses these PING constants to determine when
@@ -63,15 +56,15 @@ extern const Duration DEFAULT_HEARTBEAT_INTERVAL;
 // configurable, then we'll need to rely on upper/lower bounds
 // to ensure that the slave is not unnecessarily triggering
 // re-registrations.
-extern const Duration DEFAULT_SLAVE_PING_TIMEOUT;
+constexpr Duration DEFAULT_SLAVE_PING_TIMEOUT = Seconds(15);
 
 // Maximum number of ping timeouts until slave is considered failed.
-extern const size_t DEFAULT_MAX_SLAVE_PING_TIMEOUTS;
+constexpr size_t DEFAULT_MAX_SLAVE_PING_TIMEOUTS = 5;
 
 // The minimum timeout that can be used by a newly elected leader to
 // allow re-registration of slaves. Any slaves that do not re-register
 // within this timeout will be shutdown.
-extern const Duration MIN_SLAVE_REREGISTER_TIMEOUT;
+constexpr Duration MIN_SLAVE_REREGISTER_TIMEOUT = Minutes(10);
 
 // Default limit on the percentage of slaves that will be removed
 // after recovering if no re-registration attempts were made.
@@ -82,59 +75,59 @@ extern const Duration MIN_SLAVE_REREGISTER_TIMEOUT;
 // production clusters. This TODO is to provide a --production flag
 // which would allow flag defaults that are more appropriate for
 // production use-cases.
-extern const double RECOVERY_SLAVE_REMOVAL_PERCENT_LIMIT;
+constexpr double RECOVERY_SLAVE_REMOVAL_PERCENT_LIMIT = 1.0; // 100%.
 
 // Maximum number of removed slaves to store in the cache.
-extern const size_t MAX_REMOVED_SLAVES;
+constexpr size_t MAX_REMOVED_SLAVES = 100000;
 
 // Default maximum number of completed frameworks to store in the cache.
-extern const size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS;
+constexpr size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS = 50;
 
 // Default maximum number of completed tasks per framework
 // to store in the cache.
-extern const size_t DEFAULT_MAX_COMPLETED_TASKS_PER_FRAMEWORK;
+constexpr size_t DEFAULT_MAX_COMPLETED_TASKS_PER_FRAMEWORK = 1000;
 
 // Time interval to check for updated watchers list.
-extern const Duration WHITELIST_WATCH_INTERVAL;
+constexpr Duration WHITELIST_WATCH_INTERVAL = Seconds(5);
 
 // Default number of tasks (limit) for /master/tasks endpoint.
-extern const uint32_t TASK_LIMIT;
+constexpr uint32_t TASK_LIMIT = 100;
 
 /**
  * Label used by the Leader Contender and Detector.
  *
  * \deprecated Will be deprecated as of Mesos 0.24: see MESOS-2340.
  */
-extern const std::string MASTER_INFO_LABEL;
+const std::string MASTER_INFO_LABEL = "info";
 
 /**
  * Label used by the Leader Contender and Detector, for JSON content.
  *
  * \since Mesos 0.23 (see MESOS-2340).
  */
-extern const std::string MASTER_INFO_JSON_LABEL;
+const std::string MASTER_INFO_JSON_LABEL = "json.info";
 
 // Timeout used for ZooKeeper related operations.
 // TODO(vinod): Master detector/contender should use this timeout.
-extern const Duration ZOOKEEPER_SESSION_TIMEOUT;
+constexpr Duration ZOOKEEPER_SESSION_TIMEOUT = Seconds(10);
 
 // Name of the default, CRAM-MD5 authenticator.
-extern const std::string DEFAULT_AUTHENTICATOR;
+const std::string DEFAULT_AUTHENTICATOR = "crammd5";
 
 // Name of the default, HierarchicalDRF authenticator.
-extern const std::string DEFAULT_ALLOCATOR;
+const std::string DEFAULT_ALLOCATOR = "HierarchicalDRF";
 
 // The default interval between allocations.
-extern const Duration DEFAULT_ALLOCATION_INTERVAL;
+constexpr Duration DEFAULT_ALLOCATION_INTERVAL = Seconds(1);
 
 // Name of the default, local authorizer.
-extern const std::string DEFAULT_AUTHORIZER;
+const std::string DEFAULT_AUTHORIZER = "local";
 
 // Name of the default, basic authenticator.
-extern const std::string DEFAULT_HTTP_AUTHENTICATOR;
+const std::string DEFAULT_HTTP_AUTHENTICATOR = "basic";
 
 // Name of the default, "mesos" HTTP authentication realm.
-extern const std::string DEFAULT_HTTP_AUTHENTICATION_REALM;
+const std::string DEFAULT_HTTP_AUTHENTICATION_REALM = "mesos";
 
 } // namespace master {
 } // namespace internal {


[2/7] mesos git commit: Marked the Duration class constants as `constexpr`.

Posted by bm...@apache.org.
Marked the Duration class constants as `constexpr`.

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


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

Branch: refs/heads/master
Commit: 6ce23f80b9c1e3757d3b727bac1f17c70dd62a9d
Parents: b27366f
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:09:41 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:09:41 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/duration.hpp       | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6ce23f80/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
index ecec706..aea2808 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
@@ -167,14 +167,14 @@ public:
   static constexpr Duration zero() { return Duration(); }
 
 protected:
-  static const int64_t NANOSECONDS  = 1;
-  static const int64_t MICROSECONDS = 1000 * NANOSECONDS;
-  static const int64_t MILLISECONDS = 1000 * MICROSECONDS;
-  static const int64_t SECONDS      = 1000 * MILLISECONDS;
-  static const int64_t MINUTES      = 60 * SECONDS;
-  static const int64_t HOURS        = 60 * MINUTES;
-  static const int64_t DAYS         = 24 * HOURS;
-  static const int64_t WEEKS        = 7 * DAYS;
+  static constexpr int64_t NANOSECONDS  = 1;
+  static constexpr int64_t MICROSECONDS = 1000 * NANOSECONDS;
+  static constexpr int64_t MILLISECONDS = 1000 * MICROSECONDS;
+  static constexpr int64_t SECONDS      = 1000 * MILLISECONDS;
+  static constexpr int64_t MINUTES      = 60 * SECONDS;
+  static constexpr int64_t HOURS        = 60 * MINUTES;
+  static constexpr int64_t DAYS         = 24 * HOURS;
+  static constexpr int64_t WEEKS        = 7 * DAYS;
 
   // Construct from a (value, unit) pair.
   constexpr Duration(int64_t value, int64_t unit)


[6/7] mesos git commit: Replaced `const string` slave constants with `constexpr char[]`.

Posted by bm...@apache.org.
Replaced `const string` slave constants with `constexpr char[]`.

Per style guide.

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


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

Branch: refs/heads/master
Commit: 716b47f0498ff05fb994bba16c00d468e200be80
Parents: d431f63
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:30:40 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:30:40 2016 -0800

----------------------------------------------------------------------
 src/slave/constants.hpp | 6 +++---
 src/slave/flags.cpp     | 7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/716b47f0/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index 7301ab2..4110061 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -71,7 +71,7 @@ constexpr Bytes DEFAULT_MEM = Gigabytes(1);
 constexpr Bytes DEFAULT_DISK = Gigabytes(10);
 
 // Default ports range offered by the slave.
-const std::string DEFAULT_PORTS = "[31000-32000]";
+constexpr char DEFAULT_PORTS[] = "[31000-32000]";
 
 // Default cpu resource given to a command executor.
 constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
@@ -98,7 +98,7 @@ constexpr Duration DOCKER_INSPECT_DELAY = Seconds(1);
 constexpr Duration DOCKER_VERSION_WAIT_TIMEOUT = Seconds(5);
 
 // Name of the default, CRAM-MD5 authenticatee.
-const std::string DEFAULT_AUTHENTICATEE = "crammd5";
+constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
 
 // Default maximum storage space to be used by the fetcher cache.
 constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE = Gigabytes(2);
@@ -112,7 +112,7 @@ constexpr int DOCKER_PS_MAX_INSPECT_CALLS = 100;
 Duration DEFAULT_MASTER_PING_TIMEOUT();
 
 // Container path that the slave sets to mount the command executor rootfs to.
-const std::string COMMAND_EXECUTOR_ROOTFS_CONTAINER_PATH = ".rootfs";
+constexpr char COMMAND_EXECUTOR_ROOTFS_CONTAINER_PATH[] = ".rootfs";
 
 } // namespace slave {
 } // namespace internal {

http://git-wip-us.apache.org/repos/asf/mesos/blob/716b47f0/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index eb47015..5bacf10 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -27,6 +27,7 @@
 
 #include "slave/constants.hpp"
 
+using std::string;
 
 mesos::internal::slave::Flags::Flags()
 {
@@ -656,10 +657,8 @@ mesos::internal::slave::Flags::Flags()
   add(&Flags::authenticatee,
       "authenticatee",
       "Authenticatee implementation to use when authenticating against the\n"
-      "master. Use the default `" +
-        DEFAULT_AUTHENTICATEE +
-        "`, or\n"
-        "load an alternate authenticatee module using `--modules`.",
+      "master. Use the default `" + string(DEFAULT_AUTHENTICATEE) + "`, or\n"
+      "load an alternate authenticatee module using `--modules`.",
       DEFAULT_AUTHENTICATEE);
 
   add(&Flags::hooks,


[5/7] mesos git commit: Avoided external linkage for slave constants.

Posted by bm...@apache.org.
Avoided external linkage for slave constants.

We were only using external linkage to workaround bugs in ancient
(4.1.x) of GCC. We can also mark most of these constants `constexpr`
to bring this up-to-date with the latest style guidelines.

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


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

Branch: refs/heads/master
Commit: d431f639533a97106fa667ea298f43b0aabf9ec9
Parents: 14e9652
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:28:33 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:29:03 2016 -0800

----------------------------------------------------------------------
 src/slave/constants.cpp | 31 ---------------------
 src/slave/constants.hpp | 65 ++++++++++++++++++++------------------------
 2 files changed, 30 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d431f639/src/slave/constants.cpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.cpp b/src/slave/constants.cpp
index 0f0d8e4..fb6b9f8 100644
--- a/src/slave/constants.cpp
+++ b/src/slave/constants.cpp
@@ -14,8 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include <stdint.h>
-
 #include "master/constants.hpp"
 
 #include "slave/constants.hpp"
@@ -24,35 +22,6 @@ namespace mesos {
 namespace internal {
 namespace slave {
 
-const Duration EXECUTOR_REGISTRATION_TIMEOUT = Minutes(1);
-const Duration EXECUTOR_SHUTDOWN_GRACE_PERIOD = Seconds(5);
-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 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;
-const Duration DISK_WATCH_INTERVAL = Minutes(1);
-const Duration RECOVERY_TIMEOUT = Minutes(15);
-const uint32_t MAX_COMPLETED_FRAMEWORKS = 50;
-const uint32_t MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK = 150;
-const uint32_t MAX_COMPLETED_TASKS_PER_EXECUTOR = 200;
-const double DEFAULT_CPUS = 1;
-const Bytes DEFAULT_MEM = Gigabytes(1);
-const Bytes DEFAULT_DISK = Gigabytes(10);
-const std::string DEFAULT_PORTS = "[31000-32000]";
-#ifdef WITH_NETWORK_ISOLATOR
-const uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER = 1024;
-#endif
-const Duration DOCKER_REMOVE_DELAY = Hours(6);
-const Duration DOCKER_INSPECT_DELAY = Seconds(1);
-// TODO(tnachen): Make this a flag.
-const Duration DOCKER_VERSION_WAIT_TIMEOUT = Seconds(5);
-const std::string DEFAULT_AUTHENTICATEE = "crammd5";
-const std::string COMMAND_EXECUTOR_ROOTFS_CONTAINER_PATH = ".rootfs";
-
 Duration DEFAULT_MASTER_PING_TIMEOUT()
 {
   return master::DEFAULT_SLAVE_PING_TIMEOUT *

http://git-wip-us.apache.org/repos/asf/mesos/blob/d431f639/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index bcbb140..7301ab2 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -26,98 +26,93 @@ namespace mesos {
 namespace internal {
 namespace slave {
 
-// TODO(bmahler): It appears there may be a bug with gcc-4.1.2 in which these
-// duration constants were not being initialized when having static linkage.
-// This issue did not manifest in newer gcc's. Specifically, 4.2.1 was ok.
-// So we've moved these to have external linkage but perhaps in the future
-// we can revert this.
-
 // TODO(jieyu): Use static functions for all the constants. See more
 // details in MESOS-1023.
 
-extern const Duration EXECUTOR_REGISTRATION_TIMEOUT;
-extern const Duration EXECUTOR_SHUTDOWN_GRACE_PERIOD;
-extern const Duration EXECUTOR_REREGISTER_TIMEOUT;
-extern const Duration EXECUTOR_SIGNAL_ESCALATION_TIMEOUT;
-extern const Duration RECOVERY_TIMEOUT;
-extern const Duration STATUS_UPDATE_RETRY_INTERVAL_MIN;
-extern const Duration STATUS_UPDATE_RETRY_INTERVAL_MAX;
-extern const Duration GC_DELAY;
-extern const Duration DISK_WATCH_INTERVAL;
+constexpr Duration EXECUTOR_REGISTRATION_TIMEOUT = Minutes(1);
+constexpr Duration EXECUTOR_SHUTDOWN_GRACE_PERIOD = Seconds(5);
+constexpr Duration EXECUTOR_REREGISTER_TIMEOUT = Seconds(2);
+constexpr Duration EXECUTOR_SIGNAL_ESCALATION_TIMEOUT = Seconds(3);
+constexpr Duration RECOVERY_TIMEOUT = Minutes(15);
+constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MIN = Seconds(10);
+constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MAX = Minutes(10);;
+constexpr Duration GC_DELAY = Weeks(1);
+constexpr Duration DISK_WATCH_INTERVAL = Minutes(1);
 
 // Default backoff interval used by the slave to wait before registration.
-extern const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR;
+constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(1);
 
 // The maximum interval the slave waits before retrying registration.
 // Note that this value has to be << 'MIN_SLAVE_REREGISTER_TIMEOUT'
 // declared in 'master/constants.hpp'. This helps the slave to retry
 // (re-)registration multiple times between when the master finishes
 // recovery and when it times out slave re-registration.
-extern const Duration REGISTER_RETRY_INTERVAL_MAX;
+constexpr Duration REGISTER_RETRY_INTERVAL_MAX = Minutes(1);
 
 // Minimum free disk capacity enforced by the garbage collector.
-extern const double GC_DISK_HEADROOM;
+constexpr double GC_DISK_HEADROOM = 0.1;
 
 // Maximum number of completed frameworks to store in memory.
-extern const uint32_t MAX_COMPLETED_FRAMEWORKS;
+constexpr uint32_t MAX_COMPLETED_FRAMEWORKS = 50;
 
 // Maximum number of completed executors per framework to store in memory.
-extern const uint32_t MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK;
+constexpr uint32_t MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK = 150;
 
 // Maximum number of completed tasks per executor to store in memory.
-extern const uint32_t MAX_COMPLETED_TASKS_PER_EXECUTOR;
+constexpr uint32_t MAX_COMPLETED_TASKS_PER_EXECUTOR = 200;
 
 // Default cpus offered by the slave.
-extern const double DEFAULT_CPUS;
+constexpr double DEFAULT_CPUS = 1;
 
 // Default memory offered by the slave.
-extern const Bytes DEFAULT_MEM;
+constexpr Bytes DEFAULT_MEM = Gigabytes(1);
 
 // Default disk space offered by the slave.
-extern const Bytes DEFAULT_DISK;
+constexpr Bytes DEFAULT_DISK = Gigabytes(10);
 
 // Default ports range offered by the slave.
-extern const std::string DEFAULT_PORTS;
+const std::string DEFAULT_PORTS = "[31000-32000]";
 
 // Default cpu resource given to a command executor.
-const double DEFAULT_EXECUTOR_CPUS = 0.1;
+constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
 
 // Default memory resource given to a command executor.
-const Bytes DEFAULT_EXECUTOR_MEM = Megabytes(32);
+constexpr Bytes DEFAULT_EXECUTOR_MEM = Megabytes(32);
 
 #ifdef WITH_NETWORK_ISOLATOR
 // Default number of ephemeral ports allocated to a container by the
 // network isolator.
-extern const uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER;
+constexpr uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER = 1024;
 #endif
 
 // Default duration that docker containers will be removed after exit.
-extern const Duration DOCKER_REMOVE_DELAY;
+constexpr Duration DOCKER_REMOVE_DELAY = Hours(6);
 
 // Default duration to wait before retry inspecting a docker
 // container.
-extern const Duration DOCKER_INSPECT_DELAY;
+constexpr Duration DOCKER_INSPECT_DELAY = Seconds(1);
 
 // Default duration that docker containerizer will wait to check
 // docker version.
-extern const Duration DOCKER_VERSION_WAIT_TIMEOUT;
+// TODO(tnachen): Make this a flag.
+constexpr Duration DOCKER_VERSION_WAIT_TIMEOUT = Seconds(5);
 
 // Name of the default, CRAM-MD5 authenticatee.
-extern const std::string DEFAULT_AUTHENTICATEE;
+const std::string DEFAULT_AUTHENTICATEE = "crammd5";
 
 // Default maximum storage space to be used by the fetcher cache.
-const Bytes DEFAULT_FETCHER_CACHE_SIZE = Gigabytes(2);
+constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE = Gigabytes(2);
 
 // Default maximum number of docker inspect calls docker ps will invoke
 // in parallel to prevent hitting system's open file descriptor limit.
-const int DOCKER_PS_MAX_INSPECT_CALLS = 100;
+constexpr int DOCKER_PS_MAX_INSPECT_CALLS = 100;
 
 // If no pings received within this timeout, then the slave will
 // trigger a re-detection of the master to cause a re-registration.
 Duration DEFAULT_MASTER_PING_TIMEOUT();
 
 // Container path that the slave sets to mount the command executor rootfs to.
-extern const std::string COMMAND_EXECUTOR_ROOTFS_CONTAINER_PATH;
+const std::string COMMAND_EXECUTOR_ROOTFS_CONTAINER_PATH = ".rootfs";
 
 } // namespace slave {
 } // namespace internal {


[7/7] mesos git commit: Avoided external linkage for sched constants.

Posted by bm...@apache.org.
Avoided external linkage for sched constants.

We were only using external linkage to workaround bugs in ancient
(4.1.x) of GCC. We can also mark most of these constants `constexpr`
to bring this up-to-date with the latest style guidelines.

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


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

Branch: refs/heads/master
Commit: da45261f5a339c9376785f7e44c4d88a193b1a17
Parents: 716b47f
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:31:44 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:32:53 2016 -0800

----------------------------------------------------------------------
 src/CMakeLists.txt      |  1 -
 src/Makefile.am         |  1 -
 src/sched/constants.cpp | 36 ------------------------------------
 src/sched/constants.hpp | 13 ++++++++++---
 src/sched/flags.hpp     |  4 ++--
 5 files changed, 12 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a41d3cc..0517dd1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -223,7 +223,6 @@ set(MODULE_SRC
   )
 
 set(SCHED_SRC
-  sched/constants.cpp
   sched/sched.cpp
   )
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 5157b15..f2a592d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -641,7 +641,6 @@ libmesos_no_3rdparty_la_SOURCES +=					\
   master/allocator/sorter/drf/sorter.cpp				\
   messages/messages.cpp							\
   module/manager.cpp							\
-  sched/constants.cpp							\
   sched/sched.cpp							\
   scheduler/scheduler.cpp						\
   slave/constants.cpp							\

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/sched/constants.cpp
----------------------------------------------------------------------
diff --git a/src/sched/constants.cpp b/src/sched/constants.cpp
deleted file mode 100644
index c00b8ba..0000000
--- a/src/sched/constants.cpp
+++ /dev/null
@@ -1,36 +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 "sched/constants.hpp"
-
-namespace mesos {
-namespace internal {
-namespace scheduler {
-
-// NOTE: The default backoff factor for the scheduler (2s) is
-// different from the slave (1s) because the scheduler driver doesn't
-// 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 DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(2);
-
-const Duration REGISTRATION_RETRY_INTERVAL_MAX = Minutes(1);
-
-const std::string DEFAULT_AUTHENTICATEE = "crammd5";
-
-} // namespace scheduler {
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/sched/constants.hpp
----------------------------------------------------------------------
diff --git a/src/sched/constants.hpp b/src/sched/constants.hpp
index 523c6d9..df8a1cc 100644
--- a/src/sched/constants.hpp
+++ b/src/sched/constants.hpp
@@ -25,14 +25,21 @@ namespace scheduler {
 
 // Default backoff interval used by the scheduler driver to wait
 // before registration.
-extern const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR;
+//
+// NOTE: The default backoff factor for the scheduler (2s) is
+// different from the slave (1s) because the scheduler driver doesn't
+// 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.
+constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(2);
 
 // The maximum interval the scheduler driver waits before retrying
 // registration.
-extern const Duration REGISTRATION_RETRY_INTERVAL_MAX;
+constexpr Duration REGISTRATION_RETRY_INTERVAL_MAX = Minutes(1);
 
 // Name of the default, CRAM-MD5 authenticatee.
-extern const std::string DEFAULT_AUTHENTICATEE;
+constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
 
 } // namespace scheduler {
 } // namespace internal {

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/sched/flags.hpp
----------------------------------------------------------------------
diff --git a/src/sched/flags.hpp b/src/sched/flags.hpp
index 57dbab8..b4ca12b 100644
--- a/src/sched/flags.hpp
+++ b/src/sched/flags.hpp
@@ -96,8 +96,8 @@ public:
     add(&Flags::authenticatee,
         "authenticatee",
         "Authenticatee implementation to use when authenticating against the\n"
-        "master. Use the default '" + DEFAULT_AUTHENTICATEE + "', or\n"
-        "load an alternate authenticatee module using MESOS_MODULES.",
+        "master. Use the default '" + std::string(DEFAULT_AUTHENTICATEE) + "'\n"
+        "or load an alternate authenticatee module using MESOS_MODULES.",
         DEFAULT_AUTHENTICATEE);
   }
 


[4/7] mesos git commit: Replaced `const string` master constants with `constexpr char[]`.

Posted by bm...@apache.org.
Replaced `const string` master constants with `constexpr char[]`.

Per style guide.

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


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

Branch: refs/heads/master
Commit: 14e9652025a66008e9f55b3583b477cefe124e9e
Parents: 83001de
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:15:54 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:21:34 2016 -0800

----------------------------------------------------------------------
 src/master/constants.hpp | 16 +++++++---------
 src/master/flags.cpp     | 21 +++++++++++----------
 src/tests/flags.hpp      |  4 ++--
 3 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/14e96520/src/master/constants.hpp
----------------------------------------------------------------------
diff --git a/src/master/constants.hpp b/src/master/constants.hpp
index f87c2d5..a188da3 100644
--- a/src/master/constants.hpp
+++ b/src/master/constants.hpp
@@ -19,8 +19,6 @@
 
 #include <stdint.h>
 
-#include <string>
-
 #include <stout/bytes.hpp>
 #include <stout/duration.hpp>
 
@@ -98,36 +96,36 @@ constexpr uint32_t TASK_LIMIT = 100;
  *
  * \deprecated Will be deprecated as of Mesos 0.24: see MESOS-2340.
  */
-const std::string MASTER_INFO_LABEL = "info";
+constexpr char MASTER_INFO_LABEL[] = "info";
 
 /**
  * Label used by the Leader Contender and Detector, for JSON content.
  *
  * \since Mesos 0.23 (see MESOS-2340).
  */
-const std::string MASTER_INFO_JSON_LABEL = "json.info";
+constexpr char MASTER_INFO_JSON_LABEL[] = "json.info";
 
 // Timeout used for ZooKeeper related operations.
 // TODO(vinod): Master detector/contender should use this timeout.
 constexpr Duration ZOOKEEPER_SESSION_TIMEOUT = Seconds(10);
 
 // Name of the default, CRAM-MD5 authenticator.
-const std::string DEFAULT_AUTHENTICATOR = "crammd5";
+constexpr char DEFAULT_AUTHENTICATOR[] = "crammd5";
 
 // Name of the default, HierarchicalDRF authenticator.
-const std::string DEFAULT_ALLOCATOR = "HierarchicalDRF";
+constexpr char DEFAULT_ALLOCATOR[] = "HierarchicalDRF";
 
 // The default interval between allocations.
 constexpr Duration DEFAULT_ALLOCATION_INTERVAL = Seconds(1);
 
 // Name of the default, local authorizer.
-const std::string DEFAULT_AUTHORIZER = "local";
+constexpr char DEFAULT_AUTHORIZER[] = "local";
 
 // Name of the default, basic authenticator.
-const std::string DEFAULT_HTTP_AUTHENTICATOR = "basic";
+constexpr char DEFAULT_HTTP_AUTHENTICATOR[] = "basic";
 
 // Name of the default, "mesos" HTTP authentication realm.
-const std::string DEFAULT_HTTP_AUTHENTICATION_REALM = "mesos";
+constexpr char DEFAULT_HTTP_AUTHENTICATION_REALM[] = "mesos";
 
 } // namespace master {
 } // namespace internal {

http://git-wip-us.apache.org/repos/asf/mesos/blob/14e96520/src/master/flags.cpp
----------------------------------------------------------------------
diff --git a/src/master/flags.cpp b/src/master/flags.cpp
index c1dd127..0d9c21f 100644
--- a/src/master/flags.cpp
+++ b/src/master/flags.cpp
@@ -22,6 +22,7 @@
 #include "master/constants.hpp"
 #include "master/flags.hpp"
 
+using std::string;
 
 mesos::internal::master::Flags::Flags()
 {
@@ -247,8 +248,8 @@ mesos::internal::master::Flags::Flags()
       "or `/path/to/file`.\n"
       "\n"
       "Note that if the flag `--authorizers` is provided with a value\n"
-      "different than `" + DEFAULT_AUTHORIZER + "`, the ACLs contents will be\n"
-      "ignored.\n"
+      "different than `" + string(DEFAULT_AUTHORIZER) + "`, the ACLs contents\n"
+      "will be ignored.\n"
       "\n"
       "See the ACLs protobuf in authorizer.proto for the expected format.\n"
       "\n"
@@ -397,14 +398,14 @@ mesos::internal::master::Flags::Flags()
   add(&Flags::authenticators,
       "authenticators",
       "Authenticator implementation to use when authenticating frameworks\n"
-      "and/or slaves. Use the default `" + DEFAULT_AUTHENTICATOR + "`, or\n"
-      "load an alternate authenticator module using `--modules`.",
+      "and/or slaves. Use the default `" + string(DEFAULT_AUTHENTICATOR) + "`\n"
+      "or load an alternate authenticator module using `--modules`.",
       DEFAULT_AUTHENTICATOR);
 
   add(&Flags::allocator,
       "allocator",
       "Allocator to use for resource allocation to frameworks.\n"
-      "Use the default `" + DEFAULT_ALLOCATOR + "` allocator, or\n"
+      "Use the default `" + string(DEFAULT_ALLOCATOR) + "` allocator, or\n"
       "load an alternate allocator module using `--modules`.",
       DEFAULT_ALLOCATOR);
 
@@ -448,12 +449,12 @@ mesos::internal::master::Flags::Flags()
       "authorizers",
       "Authorizer implementation to use when authorizing actions that\n"
       "require it.\n"
-      "Use the default `" + DEFAULT_AUTHORIZER + "`, or\n"
+      "Use the default `" + string(DEFAULT_AUTHORIZER) + "`, or\n"
       "load an alternate authorizer module using `--modules`.\n"
       "\n"
       "Note that if the flag `--authorizers` is provided with a value\n"
-      "different than the default `" + DEFAULT_AUTHORIZER + "`, the ACLs\n"
-      "passed through the `--acls` flag will be ignored.\n"
+      "different than the default `" + string(DEFAULT_AUTHORIZER) + "`, the\n"
+      "ACLs passed through the `--acls` flag will be ignored.\n"
       "\n"
       "Currently there's no support for multiple authorizers.",
       DEFAULT_AUTHORIZER);
@@ -462,8 +463,8 @@ mesos::internal::master::Flags::Flags()
       "http_authenticators",
       "HTTP authenticator implementation to use when handling requests to\n"
       "authenticated endpoints. Use the default\n"
-      "`" + DEFAULT_HTTP_AUTHENTICATOR + "`, or load an alternate HTTP\n"
-      "authenticator module using `--modules`.\n"
+      "`" + string(DEFAULT_HTTP_AUTHENTICATOR) + "`, or load an alternate\n"
+      "HTTP authenticator module using `--modules`.\n"
       "\n"
       "Currently there is no support for multiple HTTP authenticators.",
       DEFAULT_HTTP_AUTHENTICATOR);

http://git-wip-us.apache.org/repos/asf/mesos/blob/14e96520/src/tests/flags.hpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.hpp b/src/tests/flags.hpp
index 542f462..af15360 100644
--- a/src/tests/flags.hpp
+++ b/src/tests/flags.hpp
@@ -145,8 +145,8 @@ public:
     add(&Flags::authenticators,
         "authenticators",
         "Authenticator implementation to use when authenticating frameworks\n"
-        "and/or slaves. "
-        "Use the default '" + master::DEFAULT_AUTHENTICATOR + "', or\n"
+        "and/or slaves. Use the default '" +
+        std::string(master::DEFAULT_AUTHENTICATOR) + "', or\n"
         "load an alternate authenticator module using --modules.",
         master::DEFAULT_AUTHENTICATOR);
   }