Repository: mesos Updated Branches: refs/heads/master 83ad6e62b -> b56b3b049
Ensure StatusUpdate.uuid is set for backwards compatiblity with 0.22.x scheduler drivers. Review: https://reviews.apache.org/r/36361 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b56b3b04 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b56b3b04 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b56b3b04 Branch: refs/heads/master Commit: b56b3b0499934c028e21c9659f3e7a67dabb827b Parents: 83ad6e6 Author: Benjamin Mahler <[email protected]> Authored: Thu Jul 9 11:15:36 2015 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Thu Jul 9 15:02:20 2015 -0700 ---------------------------------------------------------------------- src/common/protobuf_utils.cpp | 9 +++++++++ src/master/master.cpp | 2 +- src/sched/sched.cpp | 5 +++-- src/scheduler/scheduler.cpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b56b3b04/src/common/protobuf_utils.cpp ---------------------------------------------------------------------- diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp index 8a51daa..9ac81c3 100644 --- a/src/common/protobuf_utils.cpp +++ b/src/common/protobuf_utils.cpp @@ -83,6 +83,15 @@ StatusUpdate createStatusUpdate( if (uuid.isSome()) { update.set_uuid(uuid.get().toBytes()); status->set_uuid(uuid.get().toBytes()); + } else { + // Note that in 0.22.x, the StatusUpdate.uuid was required + // even though the scheduler driver ignores it for master + // and scheduler driver generated updates. So we continue + // to "set" it here so that updates coming from a 0.23.x + // master can be parsed by a 0.22.x scheduler driver. + // + // TODO(bmahler): In 0.24.x, leave the uuid unset. + update.set_uuid(""); } if (reason.isSome()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/b56b3b04/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index 35e1475..b877676 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -5148,7 +5148,7 @@ void Master::updateTask(Task* task, const StatusUpdate& update) // Set the status update state and uuid for the task. Note that // master-generated updates are terminal and do not have a uuid // (in which case the master also calls removeTask()). - if (update.has_uuid()) { + if (update.has_uuid() && update.uuid() != "") { task->set_status_update_state(status.state()); task->set_status_update_uuid(update.uuid()); } http://git-wip-us.apache.org/repos/asf/mesos/blob/b56b3b04/src/sched/sched.cpp ---------------------------------------------------------------------- diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp index a748686..e372a15 100644 --- a/src/sched/sched.cpp +++ b/src/sched/sched.cpp @@ -702,7 +702,7 @@ protected: // TODO(bmahler): For the HTTP API, we will have to update the // master and slave to ensure the 'uuid' in TaskStatus is set // correctly. - if (!update.has_uuid()) { + if (!update.has_uuid() || update.uuid() == "") { status.clear_uuid(); } else if (from == UPID() || pid == UPID()) { status.clear_uuid(); @@ -730,7 +730,8 @@ protected: } // See above for when we don't need to acknowledge. - if (update.has_uuid() && from != UPID() && pid != UPID()) { + if (update.has_uuid() && update.uuid() != "" && + from != UPID() && pid != UPID()) { // We drop updates while we're disconnected. CHECK(connected); CHECK_SOME(master); http://git-wip-us.apache.org/repos/asf/mesos/blob/b56b3b04/src/scheduler/scheduler.cpp ---------------------------------------------------------------------- diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp index d5ac04c..ac23585 100644 --- a/src/scheduler/scheduler.cpp +++ b/src/scheduler/scheduler.cpp @@ -620,7 +620,7 @@ protected: // TODO(bmahler): For the HTTP API, we will have to update the // master and slave to ensure the 'uuid' in TaskStatus is set // correctly. - if (!message.update().has_uuid()) { + if (!message.update().has_uuid() || message.update().uuid() == "") { update->mutable_status()->clear_uuid(); } else if (UPID(message.pid()) == UPID()) { update->mutable_status()->clear_uuid();
