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 2013/11/25 06:47:12 UTC

git commit: Added 'metadata' to the replicated log to support log recovery (and likely in the future log reconfiguration).

Updated Branches:
  refs/heads/master 4ef8a3714 -> bb68cff98


Added 'metadata' to the replicated log to support log recovery (and
likely in the future log reconfiguration).

From: Jie Yu <yu...@gmail.com>
Review: https://reviews.apache.org/r/15799


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

Branch: refs/heads/master
Commit: bb68cff98e3c6f1bb49c8263f97900f47d76b9ef
Parents: 4ef8a37
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sun Nov 24 21:45:27 2013 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Nov 24 21:45:27 2013 -0800

----------------------------------------------------------------------
 src/log/replica.cpp    | 10 ++++++++--
 src/messages/log.proto | 27 +++++++++++++++++++++++----
 2 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bb68cff9/src/log/replica.cpp
----------------------------------------------------------------------
diff --git a/src/log/replica.cpp b/src/log/replica.cpp
index 59a6ff3..82c2157 100644
--- a/src/log/replica.cpp
+++ b/src/log/replica.cpp
@@ -275,10 +275,16 @@ Try<State> LevelDBStorage::recover(const string& path)
     }
 
     switch (record.type()) {
+      case Record::METADATA: {
+        CHECK(record.has_metadata());
+        state.coordinator = record.metadata().promised();
+        break;
+      }
+
+      // DEPRECATED!
       case Record::PROMISE: {
         CHECK(record.has_promise());
-        const Promise& promise = record.promise();
-        state.coordinator = promise.id();
+        state.coordinator = record.promise().id();
         break;
       }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb68cff9/src/messages/log.proto
----------------------------------------------------------------------
diff --git a/src/messages/log.proto b/src/messages/log.proto
index 3d5859f..e6460ab 100644
--- a/src/messages/log.proto
+++ b/src/messages/log.proto
@@ -71,18 +71,37 @@ message Action {
 }
 
 
+// The metadata of a replica. It has to be persisted on the disk. We
+// store the current status of the replica as well as the implicit
+// promise that a replica has made. This message is intended to
+// replace the old Promise message to support catch-up.
+message Metadata {
+  enum Status {
+    VOTING = 1;      // Normal voting member in Paxos group.
+    RECOVERING = 2;  // In the process of catching up.
+    STARTING = 3;    // Transient state between EMPTY and RECOVERING.
+    EMPTY = 4;       // Initial state if start with an empty log.
+  }
+
+  required Status status = 1 [default = EMPTY];
+  required uint64 promised = 2 [default = 0];
+}
+
+
 // Represents a log record written to the local filesystem by a
-// replica. A log record may either be a promise or an action (defined
-// above).
+// replica. A log record may store a promise (DEPRECATED), an action
+// or metadata (defined above).
 message Record {
   enum Type {
-    PROMISE = 1;
+    PROMISE = 1;  // DEPRECATED!
     ACTION = 2;
+    METADATA = 3;
   }
 
   required Type type = 1;
-  optional Promise promise = 2;
+  optional Promise promise = 2;   // DEPRECATED!
   optional Action action = 3;
+  optional Metadata metadata = 4;
 }