Repository: mesos
Updated Branches:
  refs/heads/1.5.x 899efac6c -> 8186e9b7b


Added some deduplication logic to `Master::updateOperation`.

This patch adds some logic to deduplicate the status updates that are
added to `Operation::statuses`. The logic is similar to the handling
of task status updates, but we should revisit it in MESOS-8441.

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


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

Branch: refs/heads/1.5.x
Commit: 97bedbec7db9b7764434789aa8e3856c475fba74
Parents: 899efac
Author: Gaston Kleiman <[email protected]>
Authored: Fri Jan 12 18:57:32 2018 -0800
Committer: Greg Mann <[email protected]>
Committed: Sat Jan 13 09:01:19 2018 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/97bedbec/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index ea98c38..adbe1b9 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -10376,7 +10376,13 @@ void Master::updateOperation(
     operation->mutable_latest_status()->CopyFrom(status);
   }
 
-  operation->add_statuses()->CopyFrom(status);
+  // TODO(gkleiman): Revisit the de-duplication logic (MESOS-8441) - if two
+  // different terminal statuses arrive, we could end up with different states
+  // in `latest_status` and the front of statuses list.
+  if (operation->statuses().empty() ||
+      *(operation->statuses().rbegin()) != status) {
+    operation->add_statuses()->CopyFrom(status);
+  }
 
   if (!terminated) {
     return;

Reply via email to