Removed the "strict" flag from the registry operation interface. This flag is now ignored by all registry operations, so this should not result in a functional change.
Review: https://reviews.apache.org/r/51954/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ef9211f0 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ef9211f0 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ef9211f0 Branch: refs/heads/master Commit: ef9211f0e1a77896f0c5cee032dc032e9d3a0c5c Parents: 9fa9961 Author: Neil Conway <neil.con...@gmail.com> Authored: Mon Sep 19 15:49:19 2016 -0700 Committer: Vinod Kone <vinodk...@gmail.com> Committed: Mon Sep 19 15:49:19 2016 -0700 ---------------------------------------------------------------------- src/master/maintenance.cpp | 9 +++------ src/master/maintenance.hpp | 15 +++------------ src/master/master.hpp | 22 +++++----------------- src/master/quota.cpp | 6 ++---- src/master/quota.hpp | 13 ++----------- src/master/registrar.cpp | 7 ++----- src/master/registrar.hpp | 18 +++--------------- src/master/weights.cpp | 4 +++- src/master/weights.hpp | 5 +---- 9 files changed, 24 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/maintenance.cpp ---------------------------------------------------------------------- diff --git a/src/master/maintenance.cpp b/src/master/maintenance.cpp index 7da61c7..c07b815 100644 --- a/src/master/maintenance.cpp +++ b/src/master/maintenance.cpp @@ -44,8 +44,7 @@ UpdateSchedule::UpdateSchedule( Try<bool> UpdateSchedule::perform( Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict) + hashset<SlaveID>* /*slaveIDs*/) { // Put the machines in the existing schedule into a set. hashset<MachineID> existing; @@ -123,8 +122,7 @@ StartMaintenance::StartMaintenance( Try<bool> StartMaintenance::perform( Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict) + hashset<SlaveID>* /*perform*/) { // Flip the mode of all targeted machines. bool changed = false; @@ -153,8 +151,7 @@ StopMaintenance::StopMaintenance( Try<bool> StopMaintenance::perform( Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict) + hashset<SlaveID>* /*slaveIDs*/) { // Delete the machine info entry of all targeted machines. // i.e. Transition them into `UP` mode. http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/maintenance.hpp ---------------------------------------------------------------------- diff --git a/src/master/maintenance.hpp b/src/master/maintenance.hpp index 87fbb2a..b1e176c 100644 --- a/src/master/maintenance.hpp +++ b/src/master/maintenance.hpp @@ -54,10 +54,7 @@ public: const mesos::maintenance::Schedule& _schedule); protected: - Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict); + Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs); private: const mesos::maintenance::Schedule schedule; @@ -78,10 +75,7 @@ public: const google::protobuf::RepeatedPtrField<MachineID>& _ids); protected: - Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict); + Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs); private: hashset<MachineID> ids; @@ -101,10 +95,7 @@ public: const google::protobuf::RepeatedPtrField<MachineID>& _ids); protected: - Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict); + Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs); private: hashset<MachineID> ids; http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index a051742..35db198 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -1929,10 +1929,7 @@ public: } protected: - virtual Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool) + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) { // Check if this slave is currently admitted. This should only // happen if there is a slaveID collision, but that is extremely @@ -1964,10 +1961,7 @@ public: } protected: - virtual Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool) + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) { // As currently implemented, this should not be possible: the // master will only mark slaves unreachable that are currently @@ -2017,10 +2011,7 @@ public: } protected: - virtual Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool) + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) { // A slave might try to reregister that appears in the list of // admitted slaves. This can occur when the master fails over: @@ -2073,7 +2064,7 @@ public: : toRemove(_toRemove) {} protected: - virtual Try<bool> perform(Registry* registry, hashset<SlaveID>*, bool) + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* /*slaveIDs*/) { // Attempt to remove the SlaveIDs in `toRemove` from the // unreachable list. Some SlaveIDs in `toRemove` might not appear @@ -2118,10 +2109,7 @@ public: } protected: - virtual Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool) + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) { for (int i = 0; i < registry->slaves().slaves().size(); i++) { const Registry::Slave& slave = registry->slaves().slaves(i); http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/quota.cpp ---------------------------------------------------------------------- diff --git a/src/master/quota.cpp b/src/master/quota.cpp index bec6bd9..847ec06 100644 --- a/src/master/quota.cpp +++ b/src/master/quota.cpp @@ -43,8 +43,7 @@ UpdateQuota::UpdateQuota(const QuotaInfo& quotaInfo) Try<bool> UpdateQuota::perform( Registry* registry, - hashset<SlaveID>*, - bool) + hashset<SlaveID>* /*slaveIDs*/) { // If there is already quota stored for the role, update the entry. foreach (Registry::Quota& quota, *registry->mutable_quotas()) { @@ -66,8 +65,7 @@ RemoveQuota::RemoveQuota(const string& _role) : role(_role) {} Try<bool> RemoveQuota::perform( Registry* registry, - hashset<SlaveID>*, - bool) + hashset<SlaveID>* /*slaveIDs*/) { // Remove quota for the role if a corresponding entry exists. for (int i = 0; i < registry->quotas().size(); ++i) { http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/quota.hpp ---------------------------------------------------------------------- diff --git a/src/master/quota.hpp b/src/master/quota.hpp index 3cb194a..479112d 100644 --- a/src/master/quota.hpp +++ b/src/master/quota.hpp @@ -46,9 +46,6 @@ namespace quota { // will render the operation hanging (i.e. `Future` for the operation // will not be set). -// The `strict` flag is not relevant for quota operations: they will -// always succeed, even if the flag is set to `true`. - /** * Sets quota for a role. No assumptions are made here: the role may * be unknown to the master, or quota can be already set for the role. @@ -67,10 +64,7 @@ public: explicit UpdateQuota(const mesos::quota::QuotaInfo& quotaInfo); protected: - Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict); + Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs); private: const mesos::quota::QuotaInfo info; @@ -89,10 +83,7 @@ public: explicit RemoveQuota(const std::string& _role); protected: - Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict); + Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs); private: const std::string role; http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/registrar.cpp ---------------------------------------------------------------------- diff --git a/src/master/registrar.cpp b/src/master/registrar.cpp index 7aa0148..529013f 100644 --- a/src/master/registrar.cpp +++ b/src/master/registrar.cpp @@ -130,10 +130,7 @@ private: explicit Recover(const MasterInfo& _info) : info(_info) {} protected: - virtual Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict) + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) { registry->mutable_master()->mutable_info()->CopyFrom(info); return true; // Mutation. @@ -458,7 +455,7 @@ void RegistrarProcess::update() foreach (Owned<Operation> operation, operations) { // No need to process the result of the operation. - (*operation)(®istry, &slaveIDs, flags.registry_strict); + (*operation)(®istry, &slaveIDs); } LOG(INFO) << "Applied " << operations.size() << " operations in " http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/registrar.hpp ---------------------------------------------------------------------- diff --git a/src/master/registrar.hpp b/src/master/registrar.hpp index 238a960..a70132b 100644 --- a/src/master/registrar.hpp +++ b/src/master/registrar.hpp @@ -52,18 +52,11 @@ public: // Aided by accumulator(s): // slaveIDs - is the set of registered slaves. // - // NOTE: the "strict" parameter only applies to operations that - // affect slaves (i.e. registration). See Flags::registry_strict - // in master/flags.cpp for more information. - // // Returns whether the operation mutates 'registry', or an error if // the operation cannot be applied successfully. - Try<bool> operator()( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict) + Try<bool> operator()(Registry* registry, hashset<SlaveID>* slaveIDs) { - const Try<bool> result = perform(registry, slaveIDs, strict); + const Try<bool> result = perform(registry, slaveIDs); success = !result.isError(); @@ -74,10 +67,7 @@ public: bool set() { return process::Promise<bool>::set(success); } protected: - virtual Try<bool> perform( - Registry* registry, - hashset<SlaveID>* slaveIDs, - bool strict) = 0; + virtual Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) = 0; private: bool success; @@ -101,8 +91,6 @@ private: class Registrar { public: - // If flags.registry_strict is true, all operations will be - // permitted. Registrar(const Flags& flags, mesos::state::protobuf::State* state, const Option<std::string>& authenticationRealm = None()); http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/weights.cpp ---------------------------------------------------------------------- diff --git a/src/master/weights.cpp b/src/master/weights.cpp index 4942ac8..d33f2ce 100644 --- a/src/master/weights.cpp +++ b/src/master/weights.cpp @@ -25,7 +25,9 @@ UpdateWeights::UpdateWeights(const std::vector<WeightInfo>& _weightInfos) : weightInfos(_weightInfos) {} -Try<bool> UpdateWeights::perform(Registry* registry, hashset<SlaveID>*, bool) +Try<bool> UpdateWeights::perform( + Registry* registry, + hashset<SlaveID>* /*slaveIDs*/) { bool mutated = false; if (weightInfos.empty()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/ef9211f0/src/master/weights.hpp ---------------------------------------------------------------------- diff --git a/src/master/weights.hpp b/src/master/weights.hpp index 80d1369..4b9c438 100644 --- a/src/master/weights.hpp +++ b/src/master/weights.hpp @@ -41,9 +41,6 @@ namespace weights { // will render the operation hanging (i.e. `Future` for the operation // will not be set). -// The `strict` flag is not relevant for weights update operations: they will -// always succeed, even if the flag is set to `true`. - /** * Updates weights for the specified roles. No assumptions are made here: * the roles may be unknown to the master, or weights can be already set @@ -56,7 +53,7 @@ public: explicit UpdateWeights(const std::vector<WeightInfo>& _weightInfos); protected: - Try<bool> perform(Registry* registry, hashset<SlaveID>*, bool); + Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs); private: const std::vector<WeightInfo> weightInfos;