Repository: mesos
Updated Branches:
  refs/heads/master 882e1dce8 -> 75cad1213


Disallowed combining resource providers and CheckpointResourcesMessage.

Offer operations on resource provider resources can require
asynchronous handling since they can in principal take a long time to
complete. Additionally, they can fail even after passing validation in
the master, e.g., due to outside changes to the affected resources.
For these reasons, resource provider resources require an offer
operation protocol allowing failures outside of the master and
communicating these failures to the master.

Since this feedback can only be provided asynchronously, resource
provider resources are incompatible with `CheckpointResourcesMessage`
which by design updates the agent with the master's view of the
agent's resources, and does not account for asynchronous changes to
the agent's resources (leading e.g., to incompatible state between
master and agents).

This patch makes sure that agents with resource providers do not use
the 'CheckpointResourcesMessage' protocol. This prevents users from
running resource provider agents against legacy masters.

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


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

Branch: refs/heads/master
Commit: 75cad1213e218a7f114c46c3d7c92047dae80345
Parents: 33d1ff1
Author: Benjamin Bannier <[email protected]>
Authored: Fri Oct 13 21:05:27 2017 -0700
Committer: Jie Yu <[email protected]>
Committed: Sun Oct 29 15:57:28 2017 +0100

----------------------------------------------------------------------
 src/slave/slave.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/75cad121/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index d8477b4..8e4785f 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -3438,6 +3438,18 @@ void Slave::checkpointResources(vector<Resource> 
_checkpointedResources)
   //      happens, we expect framework to reconcile based on the
   //      offers they get.
 
+  // An agent with resource providers requires an offer operation feedback
+  // protocol instead of simply checkpointing results by the master. Fail hard
+  // here instead of applying an incompatible message.
+  const bool hasResourceProviders = std::any_of(
+      totalResources.begin(),
+      totalResources.end(),
+      [](const Resource& resource) { return resource.has_provider_id(); });
+
+  CHECK(!hasResourceProviders)
+    << "Master protocol for offer operations is incompatible with agent with "
+       "resource providers";
+
   convertResourceFormat(&_checkpointedResources, POST_RESERVATION_REFINEMENT);
 
   Resources newCheckpointedResources = _checkpointedResources;

Reply via email to