You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2018/01/13 17:00:34 UTC
[1/2] mesos git commit: Added some deduplication logic to
`Master::updateOperation`.
Repository: mesos
Updated Branches:
refs/heads/master 9ecfb4aec -> 495988723
Added some deduplication logic to `Master::updateOperation`.
This patch adds some logic to deduplicate the status updates that are
added to `Operation::statuses`. The logic is similar to the handling
of task status updates, but we should revisit it in MESOS-8441.
Review: https://reviews.apache.org/r/65137/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/433a7c8a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/433a7c8a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/433a7c8a
Branch: refs/heads/master
Commit: 433a7c8acffeba57e9ffc6f395a6cb31151edfc7
Parents: 9ecfb4a
Author: Gaston Kleiman <ga...@mesosphere.io>
Authored: Fri Jan 12 18:56:17 2018 -0800
Committer: Greg Mann <gr...@gmail.com>
Committed: Sat Jan 13 08:47:28 2018 -0800
----------------------------------------------------------------------
src/master/master.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/433a7c8a/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 341881b..465336d 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -10352,7 +10352,13 @@ void Master::updateOperation(
operation->mutable_latest_status()->CopyFrom(status);
}
- operation->add_statuses()->CopyFrom(status);
+ // TODO(gkleiman): Revisit the de-duplication logic (MESOS-8441) - if two
+ // different terminal statuses arrive, we could end up with different states
+ // in `latest_status` and the front of statuses list.
+ if (operation->statuses().empty() ||
+ *(operation->statuses().rbegin()) != status) {
+ operation->add_statuses()->CopyFrom(status);
+ }
if (!terminated) {
return;
[2/2] mesos git commit: Added missing fields to the GET_MASTER
operator API call.
Posted by gr...@apache.org.
Added missing fields to the GET_MASTER operator API call.
Several fields were present in the old master '/state' endpoint
which are now not accessible via the V1 operator API. This patch
adds two such fields to the response for the GET_MASTER call.
Review: https://reviews.apache.org/r/65056/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/49598872
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/49598872
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/49598872
Branch: refs/heads/master
Commit: 4959887230a7d7c55629083be978810f48b780a3
Parents: 433a7c8
Author: Greg Mann <gr...@mesosphere.io>
Authored: Fri Jan 12 18:56:36 2018 -0800
Committer: Greg Mann <gr...@gmail.com>
Committed: Sat Jan 13 08:48:11 2018 -0800
----------------------------------------------------------------------
include/mesos/master/master.proto | 4 ++++
include/mesos/v1/master/master.proto | 4 ++++
src/master/http.cpp | 10 ++++++++--
src/tests/api_tests.cpp | 8 ++++++++
4 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/49598872/include/mesos/master/master.proto
----------------------------------------------------------------------
diff --git a/include/mesos/master/master.proto b/include/mesos/master/master.proto
index f4506fe..3e34634 100644
--- a/include/mesos/master/master.proto
+++ b/include/mesos/master/master.proto
@@ -464,6 +464,10 @@ message Response {
// Contains the master's information.
message GetMaster {
optional MasterInfo master_info = 1;
+
+ optional double start_time = 2;
+
+ optional double elected_time = 3;
}
// Contains the cluster's maintenance status.
http://git-wip-us.apache.org/repos/asf/mesos/blob/49598872/include/mesos/v1/master/master.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/master/master.proto b/include/mesos/v1/master/master.proto
index 5cb64df..6759c30 100644
--- a/include/mesos/v1/master/master.proto
+++ b/include/mesos/v1/master/master.proto
@@ -460,6 +460,10 @@ message Response {
// Contains the master's information.
message GetMaster {
optional MasterInfo master_info = 1;
+
+ optional double start_time = 2;
+
+ optional double elected_time = 3;
}
// Contains the cluster's maintenance status.
http://git-wip-us.apache.org/repos/asf/mesos/blob/49598872/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 0c2cd55..cae67b8 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -2247,8 +2247,14 @@ Future<Response> Master::Http::getMaster(
// It is guaranteed that this master has been elected as the leader.
CHECK(master->elected());
- response.mutable_get_master()->mutable_master_info()->CopyFrom(
- master->info());
+ mesos::master::Response::GetMaster* getMaster = response.mutable_get_master();
+
+ getMaster->mutable_master_info()->CopyFrom(master->info());
+
+ getMaster->set_start_time(master->startTime.secs());
+ if (master->electedTime.isSome()) {
+ getMaster->set_elected_time(master->electedTime.get().secs());
+ }
return OK(serialize(contentType, evolve(response)),
stringify(contentType));
http://git-wip-us.apache.org/repos/asf/mesos/blob/49598872/src/tests/api_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 28d4643..fb45879 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -1043,6 +1043,14 @@ TEST_P(MasterAPITest, GetMaster)
ASSERT_EQ(evolve(masterFlags.domain.get()), masterInfo.domain());
ASSERT_EQ(master.get()->getMasterInfo().ip(), masterInfo.ip());
+
+ const v1::master::Response::GetMaster getMaster = v1Response->get_master();
+
+ ASSERT_TRUE(getMaster.has_start_time());
+ ASSERT_TRUE(Clock::now().secs() > getMaster.start_time());
+
+ ASSERT_TRUE(getMaster.has_elected_time());
+ ASSERT_TRUE(Clock::now().secs() > getMaster.elected_time());
}