You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gy...@apache.org on 2017/02/11 01:26:07 UTC
mesos git commit: Added `drop` for overload to avoid custom logging.
Repository: mesos
Updated Branches:
refs/heads/master f40e3d5fb -> 456aa6c20
Added `drop` for overload to avoid custom logging.
Added `drop` for overload to avoid custom logging.
Review: https://reviews.apache.org/r/56524/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/456aa6c2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/456aa6c2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/456aa6c2
Branch: refs/heads/master
Commit: 456aa6c20901810a2cd1d701d9aac0d00dae3803
Parents: f40e3d5
Author: Guangya Liu <gy...@apache.org>
Authored: Sat Feb 11 09:20:32 2017 +0800
Committer: Guangya Liu <gy...@gmail.com>
Committed: Sat Feb 11 09:21:11 2017 +0800
----------------------------------------------------------------------
src/master/master.cpp | 71 +++++++++++++++++++++++++++++++++++-----------
src/master/master.hpp | 15 ++++++++++
2 files changed, 70 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/456aa6c2/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 80d481b..0cf81ad 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2234,6 +2234,47 @@ void Master::drop(
<< ": " << message;
}
+void Master::drop(
+ Framework* framework,
+ const scheduler::Call& call,
+ const std::string& message)
+{
+ CHECK_NOTNULL(framework);
+
+ // TODO(gyliu513): Increment a metric.
+
+ // TODO(gyliu513): Update all `drop` logging to `WARNING`.
+ LOG(ERROR) << "Dropping " << call.type() << " call"
+ << " from framework " << *framework
+ << ": " << message;
+}
+
+
+void Master::drop(
+ Framework* framework,
+ const scheduler::Call::Suppress& suppress,
+ const string& message)
+{
+ scheduler::Call call;
+ call.set_type(scheduler::Call::SUPPRESS);
+ call.mutable_suppress()->CopyFrom(suppress);
+
+ drop(framework, call, message);
+}
+
+
+void Master::drop(
+ Framework* framework,
+ const scheduler::Call::Revive& revive,
+ const string& message)
+{
+ scheduler::Call call;
+ call.set_type(scheduler::Call::REVIVE);
+ call.mutable_revive()->CopyFrom(revive);
+
+ drop(framework, call, message);
+}
+
void Master::receive(
const UPID& from,
@@ -3232,19 +3273,18 @@ void Master::suppress(
// when constructing `scheduler::Call::Suppress`.
Option<Error> roleError = roles::validate(role.get());
if (roleError.isSome()) {
- LOG(WARNING) << "SUPPRESS call message with invalid role: "
- << roleError.get().message;
+ drop(framework,
+ suppress,
+ "suppression role is invalid: " + roleError->message);
return;
}
if (framework->roles.count(role.get()) == 0) {
- // TODO(gyliu513): Consider adding a `drop` overload to avoid
- // custom logging here.
- LOG(WARNING)
- << "Ignoring SUPPRESS call message for framework " << *framework
- << " with role " << role.get() << " because it is not one of the"
- << " framework's subscribed roles";
+ drop(framework,
+ suppress,
+ "suppression role " + role.get() + " is not one"
+ " of the frameworks's subscribed roles");
return;
}
@@ -4852,19 +4892,18 @@ void Master::revive(
if (role.isSome()) {
Option<Error> roleError = roles::validate(role.get());
if (roleError.isSome()) {
- LOG(WARNING) << "REVIVE call message with invalid role: "
- << roleError.get().message;
+ drop(framework,
+ revive,
+ "revive role is invalid: " + roleError->message);
return;
}
if (framework->roles.count(role.get()) == 0) {
- // TODO(gyliu513): Consider adding a `drop` overload to avoid
- // custom logging here.
- LOG(WARNING)
- << "Ignoring REVIVE call message for framework " << *framework
- << " with role " << role.get() << " because it does not exist in"
- << " framework roles";
+ drop(framework,
+ revive,
+ "revive role " + role.get() + " is not one"
+ " of the frameworks's subscribed roles");
return;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/456aa6c2/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 70f50f4..764adb1 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -817,6 +817,21 @@ private:
const Offer::Operation& operation,
const std::string& message);
+ void drop(
+ Framework* framework,
+ const scheduler::Call& call,
+ const std::string& message);
+
+ void drop(
+ Framework* framework,
+ const scheduler::Call::Suppress& suppress,
+ const std::string& message);
+
+ void drop(
+ Framework* framework,
+ const scheduler::Call::Revive& revive,
+ const std::string& message);
+
// Call handlers.
void receive(
const process::UPID& from,