You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by as...@apache.org on 2020/04/06 14:15:54 UTC
[mesos] branch master updated: Skip not yet known framework IDs in
`generateInverseOffers()`.
This is an automated email from the ASF dual-hosted git repository.
asekretenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new 3b1eca8 Skip not yet known framework IDs in `generateInverseOffers()`.
3b1eca8 is described below
commit 3b1eca806547a67b5c69ecc17032f2e4704712ad
Author: Andrei Sekretenko <as...@apache.org>
AuthorDate: Fri Apr 3 14:37:50 2020 +0200
Skip not yet known framework IDs in `generateInverseOffers()`.
This patch fixes MESOS-10109 by making hierarchical allocator, when
it generates inverse offers, skip IDs of frameworks returned by
`Slave::getOfferedOrAllocated()` that have not yet been added
to the allocator via `addFramework()`.
Review: https://reviews.apache.org/r/72314
---
include/mesos/allocator/allocator.hpp | 5 +++++
src/master/allocator/mesos/hierarchical.cpp | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/mesos/allocator/allocator.hpp b/include/mesos/allocator/allocator.hpp
index 96fd6e3..c700528 100644
--- a/include/mesos/allocator/allocator.hpp
+++ b/include/mesos/allocator/allocator.hpp
@@ -215,6 +215,11 @@ public:
* @param used Resources that are allocated on the current agent. The
* allocator should avoid double accounting when yet unknown frameworks
* are added later in `addFramework()`.
+ *
+ * TODO(asekretenko): Ideally, to get rig of an intermediate allocator state
+ * when some resources are used by nonexistent frameworks, we should change
+ * the interface so that per-agent per-framework used resources and the
+ * not yet known frameworks that are using them are added atomically.
*/
virtual void addSlave(
const SlaveID& slaveId,
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index 0df319b..5fe9ffc 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -2458,7 +2458,17 @@ void HierarchicalAllocatorProcess::generateInverseOffers()
foreachkey (
const FrameworkID& frameworkId, slave.getOfferedOrAllocated()) {
- const Framework& framework = *CHECK_NOTNONE(getFramework(frameworkId));
+ const Option<Framework*> framework_ = getFramework(frameworkId);
+ // NOTE: This method might be called in-between adding per-framework
+ // used resources on an agent via `addSlave()` and adding a framework
+ // via `addFramework()`.
+ if (framework_.isNone()) {
+ // Framework is using resources on an agent but has not yet been
+ // re-added to allocator via addFramework().
+ continue;
+ }
+
+ const Framework& framework = **framework_;
// No need to deallocate for an inactive framework as the master
// will not send it inverse offers.