You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2018/09/03 12:58:38 UTC
[mesos] 01/06: Allowed tracking of resource providers w/o resource
version in agent.
This is an automated email from the ASF dual-hosted git repository.
bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 701e014a69b1f692f011e79169582c701ebf4f3c
Author: Benjamin Bannier <bb...@apache.org>
AuthorDate: Fri Aug 17 12:00:43 2018 +0200
Allowed tracking of resource providers w/o resource version in agent.
This will be used in a later patch introducing explicit handling of
resource provider subscription events in the agent.
Review: https://reviews.apache.org/r/68407
---
src/slave/slave.cpp | 9 ++++++++-
src/slave/slave.hpp | 4 ++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index e6c7e68..7fc90d1 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -7579,6 +7579,13 @@ UpdateSlaveMessage Slave::generateResourceProviderUpdate() const
}
foreachvalue (ResourceProvider* resourceProvider, resourceProviders) {
+ // If the resource provider has not updated its state we do not
+ // need to and cannot include its information in an
+ // `UpdateSlaveMessage` since it requires a resource version.
+ if (resourceProvider->resourceVersion.isNone()) {
+ continue;
+ }
+
UpdateSlaveMessage::ResourceProvider* provider =
message.mutable_resource_providers()->add_providers();
@@ -7587,7 +7594,7 @@ UpdateSlaveMessage Slave::generateResourceProviderUpdate() const
provider->mutable_total_resources()->CopyFrom(
resourceProvider->totalResources);
provider->mutable_resource_version_uuid()->CopyFrom(
- resourceProvider->resourceVersion);
+ resourceProvider->resourceVersion.get());
provider->mutable_operations();
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index b1d695b..6757eae 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -1182,7 +1182,7 @@ struct ResourceProvider
ResourceProvider(
const ResourceProviderInfo& _info,
const Resources& _totalResources,
- const UUID& _resourceVersion)
+ const Option<UUID>& _resourceVersion)
: info(_info),
totalResources(_totalResources),
resourceVersion(_resourceVersion) {}
@@ -1204,7 +1204,7 @@ struct ResourceProvider
// different resource version UUID than that it maintains, because
// this means the operation is operating on resources that might
// have already been invalidated.
- UUID resourceVersion;
+ Option<UUID> resourceVersion;
// Pending operations or terminal operations that have
// unacknowledged status updates.