You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/11/06 03:44:08 UTC
mesos git commit: Converted SlaveInfo resources from the registry
during master recovery.
Repository: mesos
Updated Branches:
refs/heads/master 3b0e325bc -> 2dfd753f1
Converted SlaveInfo resources from the registry during master recovery.
The intention is for us to work with resources in the `post-reservation-
refinement` format in the master memory, and store them in the master
registry or agent checkpoint in the `pre` format in order to support
downgrades. In this case, we correctly store the `pre` format resources
in the master registry, but we don't convert them back when we read it
out of the registry. This patch converts the resources back to `post`
when we read from the registry.
This simply addresses a tech-debt. The `authorizeResource` function
for example currently handles both formats because it has to account
for the old format that is stored in the recovered agents.
Review: https://reviews.apache.org/r/63232
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2dfd753f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2dfd753f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2dfd753f
Branch: refs/heads/master
Commit: 2dfd753f126fd467eaf3607b712e63581bc88b4c
Parents: 3b0e325
Author: Michael Park <mp...@apache.org>
Authored: Mon Oct 23 16:51:59 2017 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Sun Nov 5 19:22:46 2017 -0800
----------------------------------------------------------------------
src/master/master.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2dfd753f/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 49bc50e..c4afbf8 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1700,7 +1700,16 @@ Future<Nothing> Master::recover()
Future<Nothing> Master::_recover(const Registry& registry)
{
foreach (const Registry::Slave& slave, registry.slaves().slaves()) {
- slaves.recovered.put(slave.info().id(), slave.info());
+ SlaveInfo slaveInfo = slave.info();
+
+ // We store the `SlaveInfo`'s resources in the `pre-reservation-refinement`
+ // in order to support downgrades. We convert them back to `post-` format
+ // here so that we can keep our invariant of working with `post-` format
+ // resources within master memory.
+ convertResourceFormat(
+ slaveInfo.mutable_resources(), POST_RESERVATION_REFINEMENT);
+
+ slaves.recovered.put(slaveInfo.id(), slaveInfo);
}
foreach (const Registry::UnreachableSlave& unreachable,