You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/10/16 23:38:24 UTC

git commit: Added an advisory message reminding the user to initialize the log.

Repository: mesos
Updated Branches:
  refs/heads/master 941c32301 -> f1a2171a8


Added an advisory message reminding the user to initialize the log.

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


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

Branch: refs/heads/master
Commit: f1a2171a846fcf646591352dbf7ff3fd38074f99
Parents: 941c323
Author: Jie Yu <yu...@gmail.com>
Authored: Thu Oct 16 11:16:43 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Oct 16 14:36:38 2014 -0700

----------------------------------------------------------------------
 src/log/recover.cpp | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f1a2171a/src/log/recover.cpp
----------------------------------------------------------------------
diff --git a/src/log/recover.cpp b/src/log/recover.cpp
index 2013e91..a7d452f 100644
--- a/src/log/recover.cpp
+++ b/src/log/recover.cpp
@@ -221,6 +221,13 @@ private:
       return result;
     }
 
+    // TODO(jieyu): Currently, we simply calculate the size of the
+    // cluster from the quorum size. In the future, we may want to
+    // allow users to specify the cluster size in case they want to
+    // use a non-standard quorum size (e.g., cluster size = 5, quorum
+    // size = 4).
+    size_t clusterSize = (2 * quorum) - 1;
+
     if (autoInitialize) {
       // The following code handles the auto-initialization. Our idea
       // is: we allow a replica in EMPTY status to become VOTING
@@ -249,14 +256,6 @@ private:
       // way, in our previous example, all replicas will be in
       // STARTING status before any of them can transit to VOTING
       // status.
-
-      // TODO(jieyu): Currently, we simply calculate the size of the
-      // cluster from the quorum size. In the future, we may wanna
-      // allow users to specify the cluster size in case they want to
-      // use a non-standard quorum size (e.g., cluster size = 5,
-      // quorum size = 4).
-      size_t clusterSize = (2 * quorum) - 1;
-
       switch (status) {
         case Metadata::EMPTY:
           if ((responsesReceived[Metadata::EMPTY] +
@@ -284,6 +283,19 @@ private:
           // Ignore all other cases.
           break;
       }
+    } else {
+      // Since auto initialization is disabled, we print an advisory
+      // message to remind the user to initialize the log manually.
+      if (responsesReceived[Metadata::EMPTY] >= clusterSize) {
+        LOG(WARNING) << "\n"
+                     << "----------------------------------------------------\n"
+                     << "Replicated log has not been initialized. Did you\n"
+                     << "forget to manually initialize the log (i.e.,\n"
+                     << "mesos-log initialize <PATH>)? Note that all replicas\n"
+                     << "are not initialized and the above command needs to\n"
+                     << "be run on each host!\n";
+                     << "----------------------------------------------------";
+      }
     }
 
     // Handle the next response.