This is an automated email from the ASF dual-hosted git repository.

josephwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 529ec2783159b9b1517a49271e8b30e87deebfec
Author: Joseph Wu <[email protected]>
AuthorDate: Wed Jan 30 18:32:38 2019 -0800

    Accounted for possible lack of OperationID in RP responses.
    
    Operations sent to a resource provider may include an OperationID
    in addition to an Operation UUID.  The UUID is sufficient to uniquely
    identify the operation, so it is possible for the resource provider
    to omit the OperationID in its responses to the agent.
    
    This commit lets the agent fill in any missing ID before updates
    are acted upon, such as being sent to the master.
    
    Review: https://reviews.apache.org/r/69872
---
 src/slave/slave.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index e3c2c00..75f0d9d 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -8084,6 +8084,19 @@ void Slave::handleResourceProviderMessage(
       Operation* operation = getOperation(operationUUID);
 
       if (operation != nullptr) {
+        // It is possible for the resource provider to forget or incorrectly
+        // copy the OperationID in its status update. We make sure the ID
+        // is filled in with the correct value before proceeding.
+        if (operation->info().has_id()) {
+          update.mutable_status()->mutable_operation_id()
+            ->CopyFrom(operation->info().id());
+
+          if (update.has_latest_status()) {
+            update.mutable_latest_status()->mutable_operation_id()
+              ->CopyFrom(operation->info().id());
+          }
+        }
+
         // The agent might not know about the operation in the
         // following cases:
         //

Reply via email to