You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2017/12/02 05:34:28 UTC

[2/6] mesos git commit: Stripped AllocationInfo from offers to non-MULTI_ROLE schedulers.

Stripped AllocationInfo from offers to non-MULTI_ROLE schedulers.

Per MESOS-8237, it is problematic to show `Resource.allocation_info`
for "old" schedulers. The example that was presented was the
"mesos-go" 3rd party library that provides resource comparison logic.
The library has both MULTI-ROLE and non-MULTI_ROLE schedulers as
clients, these clients use the comparison logic supplied by the
library to see if the offer contains the resources they need.
The library author does not want to have to do any stripping of the
allocation info to preserve the equality.

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


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

Branch: refs/heads/1.3.x
Commit: 8855f0e42a0cf54e5f535092f1ebda10d323ae05
Parents: 55b498c
Author: Benjamin Mahler <bm...@apache.org>
Authored: Wed Nov 29 17:37:36 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Dec 1 20:18:15 2017 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8855f0e4/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 141d512..3975f8b 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -7294,6 +7294,23 @@ void Master::offer(
         }
       }
 
+      // Per MESOS-8237, it is problematic to show the
+      // `Resource.allocation_info` for pre-MULTI_ROLE schedulers.
+      // Pre-MULTI_ROLE schedulers are not `AllocationInfo` aware,
+      // and since they may be performing operations that
+      // implicitly uses all of Resource's state (e.g. equality
+      // comparison), we strip the `AllocationInfo` from `Resource`,
+      // as well as Offer. The idea here is that since the
+      // information doesn't provide any value to a pre-MULTI_ROLE
+      // scheduler, we preserve the old `Offer` format for them.
+      if (!framework->capabilities.multiRole) {
+        offer_.clear_allocation_info();
+
+        foreach (Resource& resource, *offer_.mutable_resources()) {
+          resource.clear_allocation_info();
+        }
+      }
+
       // Add the offer *AND* the corresponding slave's PID.
       message.add_offers()->MergeFrom(offer_);
       message.add_pids(slave->pid);