You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2017/05/17 01:14:41 UTC
[1/3] mesos git commit: Updated documentation for
`registrar/log/ensemble_size`.
Repository: mesos
Updated Branches:
refs/heads/master fff43d202 -> 382618b1f
Updated documentation for `registrar/log/ensemble_size`.
Review: https://reviews.apache.org/r/59300
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/382618b1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/382618b1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/382618b1
Branch: refs/heads/master
Commit: 382618b1f78b4e2db507c94c85be977a51669d0b
Parents: c881e17
Author: Jiang Yan Xu <xu...@apple.com>
Authored: Mon May 15 16:07:00 2017 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Tue May 16 18:04:01 2017 -0700
----------------------------------------------------------------------
docs/monitoring.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/382618b1/docs/monitoring.md
----------------------------------------------------------------------
diff --git a/docs/monitoring.md b/docs/monitoring.md
index c42afce..a027f49 100644
--- a/docs/monitoring.md
+++ b/docs/monitoring.md
@@ -945,6 +945,19 @@ the registrar, which is the persistent store for masters.
</td>
<td>Gauge</td>
</tr>
+<tr>
+ <td>
+ <code>registrar/log/ensemble_size</code>
+ </td>
+ <td>
+ The number of masters in the ensemble (cluster) that the current master
+ communicates with (including itself) to form the replicated log quorum.
+ It's imperative that this number is always less than `--quorum * 2` to
+ prevent split-brain. It's also important that it should be greater than
+ or equal to `--quorum` to maintain availability.
+ </td>
+ <td>Gauge</td>
+</tr>
</table>
#### Allocator
[2/3] mesos git commit: Added 'registrar/log/ensemble_size' metric.
Posted by ya...@apache.org.
Added 'registrar/log/ensemble_size' metric.
Review: https://reviews.apache.org/r/59290
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c881e17e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c881e17e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c881e17e
Branch: refs/heads/master
Commit: c881e17e696bf07cca8478776041eab75d574c4f
Parents: 302bb9a
Author: Jiang Yan Xu <xu...@apple.com>
Authored: Fri Sep 30 15:55:22 2016 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Tue May 16 18:04:01 2017 -0700
----------------------------------------------------------------------
src/log/log.hpp | 10 ++++++++++
src/log/metrics.cpp | 7 ++++++-
src/log/metrics.hpp | 2 ++
src/tests/log_tests.cpp | 3 +++
4 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c881e17e/src/log/log.hpp
----------------------------------------------------------------------
diff --git a/src/log/log.hpp b/src/log/log.hpp
index 097aeef..24481aa 100644
--- a/src/log/log.hpp
+++ b/src/log/log.hpp
@@ -103,6 +103,16 @@ private:
friend Metrics;
Metrics metrics;
+
+ // The size of the network. We use "ensemble" because it as a metric
+ // name more intuitively means the "replica set".
+ process::Future<double> _ensemble_size()
+ {
+ // Watching for any value different than 0 should give us the
+ // current value.
+ return network->watch(0u)
+ .then([](size_t size) -> double { return size; });
+ }
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/c881e17e/src/log/metrics.cpp
----------------------------------------------------------------------
diff --git a/src/log/metrics.cpp b/src/log/metrics.cpp
index 90b6988..20b8abf 100644
--- a/src/log/metrics.cpp
+++ b/src/log/metrics.cpp
@@ -35,15 +35,20 @@ Metrics::Metrics(
const Option<string>& prefix)
: recovered(
prefix.getOrElse("") + "log/recovered",
- defer(process, &LogProcess::_recovered))
+ defer(process, &LogProcess::_recovered)),
+ ensemble_size(
+ prefix.getOrElse("") + "log/ensemble_size",
+ defer(process, &LogProcess::_ensemble_size))
{
process::metrics::add(recovered);
+ process::metrics::add(ensemble_size);
}
Metrics::~Metrics()
{
process::metrics::remove(recovered);
+ process::metrics::remove(ensemble_size);
}
} // namespace log {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c881e17e/src/log/metrics.hpp
----------------------------------------------------------------------
diff --git a/src/log/metrics.hpp b/src/log/metrics.hpp
index 23ba6eb..b537e0a 100644
--- a/src/log/metrics.hpp
+++ b/src/log/metrics.hpp
@@ -37,6 +37,8 @@ struct Metrics
~Metrics();
process::metrics::Gauge recovered;
+
+ process::metrics::Gauge ensemble_size;
};
} // namespace log {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c881e17e/src/tests/log_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/log_tests.cpp b/src/tests/log_tests.cpp
index 52b1bfe..f9f9400 100644
--- a/src/tests/log_tests.cpp
+++ b/src/tests/log_tests.cpp
@@ -2102,6 +2102,9 @@ TEST_F(LogTest, Metrics)
ASSERT_EQ(1u, snapshot.values.count("prefix/log/recovered"));
EXPECT_EQ(1, snapshot.values["prefix/log/recovered"]);
+
+ ASSERT_EQ(1u, snapshot.values.count("prefix/log/ensemble_size"));
+ EXPECT_EQ(1, snapshot.values["prefix/log/ensemble_size"]);
}
[3/3] mesos git commit: Refactored log Metrics into separate files.
Posted by ya...@apache.org.
Refactored log Metrics into separate files.
Review: https://reviews.apache.org/r/59289
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/302bb9af
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/302bb9af
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/302bb9af
Branch: refs/heads/master
Commit: 302bb9aff020e41c82a43745779f418250dd2ddb
Parents: fff43d2
Author: Jiang Yan Xu <xu...@apple.com>
Authored: Fri Sep 30 11:23:21 2016 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Tue May 16 18:04:01 2017 -0700
----------------------------------------------------------------------
src/CMakeLists.txt | 1 +
src/Makefile.am | 2 ++
src/log/log.cpp | 17 ----------------
src/log/log.hpp | 13 +++---------
src/log/metrics.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
src/log/metrics.hpp | 46 +++++++++++++++++++++++++++++++++++++++++++
6 files changed, 103 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/302bb9af/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index eef718d..a038c0b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -337,6 +337,7 @@ set(LOG_SRC
log/leveldb.cpp
log/log.cpp
log/main.cpp
+ log/metrics.cpp
log/recover.cpp
log/replica.cpp
log/tool/benchmark.cpp
http://git-wip-us.apache.org/repos/asf/mesos/blob/302bb9af/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 6bb81fd..1522c5b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1362,6 +1362,7 @@ liblog_la_SOURCES = \
log/coordinator.cpp \
log/leveldb.cpp \
log/log.cpp \
+ log/metrics.cpp \
log/recover.cpp \
log/replica.cpp \
log/tool/benchmark.cpp \
@@ -1374,6 +1375,7 @@ liblog_la_SOURCES += \
log/coordinator.hpp \
log/leveldb.hpp \
log/log.hpp \
+ log/metrics.hpp \
log/network.hpp \
log/recover.hpp \
log/replica.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/302bb9af/src/log/log.cpp
----------------------------------------------------------------------
diff --git a/src/log/log.cpp b/src/log/log.cpp
index 2301eef..dcb66f7 100644
--- a/src/log/log.cpp
+++ b/src/log/log.cpp
@@ -280,23 +280,6 @@ void LogProcess::discarded()
}
-LogProcess::Metrics::Metrics(
- const LogProcess& process,
- const Option<string>& prefix)
- : recovered(
- prefix.getOrElse("") + "log/recovered",
- defer(process, &LogProcess::_recovered))
-{
- process::metrics::add(recovered);
-}
-
-
-LogProcess::Metrics::~Metrics()
-{
- process::metrics::remove(recovered);
-}
-
-
/////////////////////////////////////////////////
// Implementation of LogReaderProcess.
/////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/mesos/blob/302bb9af/src/log/log.hpp
----------------------------------------------------------------------
diff --git a/src/log/log.hpp b/src/log/log.hpp
index a600025..097aeef 100644
--- a/src/log/log.hpp
+++ b/src/log/log.hpp
@@ -31,6 +31,7 @@
#include <stout/nothing.hpp>
#include "log/coordinator.hpp"
+#include "log/metrics.hpp"
#include "log/network.hpp"
#include "log/recover.hpp"
#include "log/replica.hpp"
@@ -100,16 +101,8 @@ private:
zookeeper::Group* group;
process::Future<zookeeper::Group::Membership> membership;
- struct Metrics
- {
- explicit Metrics(
- const LogProcess& process,
- const Option<std::string>& prefix);
-
- ~Metrics();
-
- process::metrics::Gauge recovered;
- } metrics;
+ friend Metrics;
+ Metrics metrics;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/302bb9af/src/log/metrics.cpp
----------------------------------------------------------------------
diff --git a/src/log/metrics.cpp b/src/log/metrics.cpp
new file mode 100644
index 0000000..90b6988
--- /dev/null
+++ b/src/log/metrics.cpp
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "log/metrics.hpp"
+
+#include <process/defer.hpp>
+
+#include <process/metrics/metrics.hpp>
+
+#include "log/log.hpp"
+
+using std::string;
+
+using process::defer;
+
+namespace mesos {
+namespace internal {
+namespace log {
+
+Metrics::Metrics(
+ const LogProcess& process,
+ const Option<string>& prefix)
+ : recovered(
+ prefix.getOrElse("") + "log/recovered",
+ defer(process, &LogProcess::_recovered))
+{
+ process::metrics::add(recovered);
+}
+
+
+Metrics::~Metrics()
+{
+ process::metrics::remove(recovered);
+}
+
+} // namespace log {
+} // namespace internal {
+} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/302bb9af/src/log/metrics.hpp
----------------------------------------------------------------------
diff --git a/src/log/metrics.hpp b/src/log/metrics.hpp
new file mode 100644
index 0000000..23ba6eb
--- /dev/null
+++ b/src/log/metrics.hpp
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef __LOG_METRICS_HPP__
+#define __LOG_METRICS_HPP__
+
+#include <string>
+
+#include <process/metrics/gauge.hpp>
+
+namespace mesos {
+namespace internal {
+namespace log {
+
+// Forward declaration.
+class LogProcess;
+
+struct Metrics
+{
+ Metrics(
+ const LogProcess& process,
+ const Option<std::string>& prefix);
+
+ ~Metrics();
+
+ process::metrics::Gauge recovered;
+};
+
+} // namespace log {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // __LOG_METRICS_HPP__