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 2013/12/06 00:37:09 UTC

[2/2] git commit: Fixed an exception raised in the master related to task statuses.

Fixed an exception raised in the master related to task statuses.

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


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

Branch: refs/heads/master
Commit: 081a1aba1c330f4a0eb76cdc64d34eccad0c3611
Parents: cac2d39
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Wed Dec 4 23:57:01 2013 -0800
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Thu Dec 5 15:03:58 2013 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 3 ++-
 src/slave/slave.cpp   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/081a1aba/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index b2b8db3..c610e49 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1552,7 +1552,8 @@ void Master::statusUpdate(const StatusUpdate& update, const UPID& pid)
   LOG(INFO) << "Status update " << update << " from " << pid;
 
   // TODO(brenden) Consider wiping the `data` and `message` fields?
-  if (task->state() == status.state()) {
+  if (task->statuses_size() > 0 &&
+      task->statuses(task->statuses_size() - 1).state() == task->state()) {
     task->mutable_statuses()->RemoveLast();
   }
   task->add_statuses()->CopyFrom(status);

http://git-wip-us.apache.org/repos/asf/mesos/blob/081a1aba/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 75d9e5d..9a8b82f 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -3284,7 +3284,8 @@ void Executor::updateTaskState(const TaskStatus& status)
   if (launchedTasks.contains(status.task_id())) {
     Task* task = launchedTasks[status.task_id()];
     // TODO(brenden): Consider wiping the `data` and `message` fields?
-    if (task->state() == status.state()) {
+    if (task->statuses_size() > 0 &&
+        task->statuses(task->statuses_size() - 1).state() == task->state()) {
       task->mutable_statuses()->RemoveLast();
     }
     task->add_statuses()->CopyFrom(status);