You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/04/01 00:32:07 UTC
git commit: Avoided unnecessary retries during log fill by using a
higher proposal number.
Repository: mesos
Updated Branches:
refs/heads/master 27f029c21 -> ffc96ef9b
Avoided unnecessary retries during log fill by using a higher proposal
number.
Review: https://reviews.apache.org/r/19852
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ffc96ef9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ffc96ef9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ffc96ef9
Branch: refs/heads/master
Commit: ffc96ef9bf343b8954dd16380ff6ee9b4ec4382b
Parents: 27f029c
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Mar 31 10:02:25 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Mar 31 15:29:34 2014 -0700
----------------------------------------------------------------------
src/log/coordinator.cpp | 10 +++++++++-
src/tests/log_tests.cpp | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ffc96ef9/src/log/coordinator.cpp
----------------------------------------------------------------------
diff --git a/src/log/coordinator.cpp b/src/log/coordinator.cpp
index caa4b85..271fe89 100644
--- a/src/log/coordinator.cpp
+++ b/src/log/coordinator.cpp
@@ -228,7 +228,15 @@ Future<Nothing> CoordinatorProcess::catchupMissingPositions(
{
LOG(INFO) << "Coordinator attemping to fill missing position";
- return log::catchup(quorum, replica, network, proposal, positions);
+ // Notice that here we use "proposal + 1" as the proposal number for
+ // fill operations in order to avoid unnecessary retries for those
+ // log positions that were just implicitly promised to this
+ // coordinator. This is safe because log::catchup would increment
+ // the proposal number automatically after failing to fill
+ // implicitly promised positions and this just shortcuts that
+ // process. See more details in MESOS-1165. We don't update the
+ // class member 'proposal' here as it's for implicit promises.
+ return log::catchup(quorum, replica, network, proposal + 1, positions);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ffc96ef9/src/tests/log_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/log_tests.cpp b/src/tests/log_tests.cpp
index b368cde..4f08927 100644
--- a/src/tests/log_tests.cpp
+++ b/src/tests/log_tests.cpp
@@ -610,6 +610,41 @@ TEST_F(CoordinatorTest, Elect)
}
+// Verifies that a coordinator can get elected with clock paused (no
+// retry involved) for an empty log.
+TEST_F(CoordinatorTest, ElectWithClockPaused)
+{
+ Clock::pause();
+
+ const string path1 = os::getcwd() + "/.log1";
+ initializer.flags.path = path1;
+ initializer.execute();
+
+ const string path2 = os::getcwd() + "/.log2";
+ initializer.flags.path = path2;
+ initializer.execute();
+
+ Shared<Replica> replica1(new Replica(path1));
+ Shared<Replica> replica2(new Replica(path2));
+
+ set<UPID> pids;
+ pids.insert(replica1->pid());
+ pids.insert(replica2->pid());
+
+ Shared<Network> network(new Network(pids));
+
+ Coordinator coord(2, replica1, network);
+
+ {
+ Future<Option<uint64_t> > electing = coord.elect();
+ AWAIT_READY(electing);
+ EXPECT_SOME_EQ(0u, electing.get());
+ }
+
+ Clock::resume();
+}
+
+
TEST_F(CoordinatorTest, AppendRead)
{
const string path1 = os::getcwd() + "/.log1";