You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2017/12/14 06:46:39 UTC

mesos git commit: Made the agent check for offer operation update retries.

Repository: mesos
Updated Branches:
  refs/heads/master 3f44f0e2f -> f6b33da25


Made the agent check for offer operation update retries.

Local resource providers send all offer operation status updates
using the reosurce provider API. This patch makes the agent's
resource provider message handler skip operation updates when an
update is a retry.

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


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

Branch: refs/heads/master
Commit: f6b33da25c3b4704db45a8ebd2cdbf5f439c9a4e
Parents: 3f44f0e
Author: Greg Mann <gr...@mesosphere.io>
Authored: Wed Dec 13 21:56:09 2017 -0800
Committer: Greg Mann <gr...@gmail.com>
Committed: Wed Dec 13 21:56:09 2017 -0800

----------------------------------------------------------------------
 src/slave/slave.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f6b33da2/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 63828a4..bde93d6 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -7409,7 +7409,24 @@ void Slave::updateOfferOperation(
     }
   }
 
-  operation->add_statuses()->CopyFrom(status);
+  // Adding the update's status to the stored operation below is the one place
+  // in this function where we mutate the operation state irrespective of the
+  // value of `terminated`. We check to see if this status update is a retry;
+  // if so, we do nothing.
+  bool isRetry = false;
+  if (status.has_status_uuid()) {
+    foreach (const OfferOperationStatus& storedStatus, operation->statuses()) {
+      if (storedStatus.has_status_uuid() &&
+          storedStatus.status_uuid() == status.status_uuid()) {
+        isRetry = true;
+        break;
+      }
+    }
+  }
+
+  if (!isRetry) {
+    operation->add_statuses()->CopyFrom(status);
+  }
 
   Try<UUID> operationUUID = UUID::fromBytes(operation->operation_uuid());
   CHECK_SOME(operationUUID);