summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-08-20 11:27:23 -0700
committerSage Weil <sage@inktank.com>2013-08-26 21:33:10 -0700
commit6a4fe7b9b068ae990d6404921a46631fe9ebcd31 (patch)
tree7db34122ccaf968796e1c53a28f6c8fbc5d6af8c
parent13d396e46ed9200e4b9f21db2f0a8efbc5998d82 (diff)
downloadceph-6a4fe7b9b068ae990d6404921a46631fe9ebcd31.tar.gz
mon/Paxos: always refresh after any store_state
If we store any new state, we need to refresh the services, even if we are still in the midst of Paxos recovery. This is because the subscription path will share any committed state even when paxos is still recovering. This prevents a race like: - we have maps 10..20 - we drop out of quorum - we are elected leader, paxos recovery starts - we get one LAST with committed states that trim maps 10..15 - we get a subscribe for map 10..20 - we crash because 10 is no longer on disk because the PaxosService is out of sync with the on-disk state. Fixes: #6045 Backport: dumpling Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com> (cherry picked from commit 981eda9f7787c83dc457f061452685f499e7dd27)
-rw-r--r--src/mon/Paxos.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc
index adb497b9d49..fa3e2089842 100644
--- a/src/mon/Paxos.cc
+++ b/src/mon/Paxos.cc
@@ -384,6 +384,8 @@ void Paxos::_sanity_check_store()
// leader
void Paxos::handle_last(MMonPaxos *last)
{
+ bool need_refresh = false;
+
dout(10) << "handle_last " << *last << dendl;
if (!mon->is_leader()) {
@@ -410,7 +412,7 @@ void Paxos::handle_last(MMonPaxos *last)
assert(g_conf->paxos_kill_at != 1);
// store any committed values if any are specified in the message
- store_state(last);
+ need_refresh = store_state(last);
assert(g_conf->paxos_kill_at != 2);
@@ -486,6 +488,7 @@ void Paxos::handle_last(MMonPaxos *last)
dout(10) << "that's everyone. active!" << dendl;
extend_lease();
+ need_refresh = false;
if (do_refresh()) {
finish_round();
@@ -500,6 +503,9 @@ void Paxos::handle_last(MMonPaxos *last)
dout(10) << "old pn, ignoring" << dendl;
}
+ if (need_refresh)
+ do_refresh();
+
last->put();
}