]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
paxos: do not create_pending if !active
authorSage Weil <sage@newdream.net>
Fri, 18 Nov 2011 17:49:03 +0000 (09:49 -0800)
committerSage Weil <sage@newdream.net>
Fri, 18 Nov 2011 17:49:03 +0000 (09:49 -0800)
This avoids a scenario like:

- _active()
  - proposes value
- _commit()
  - creates new pending, even though in updating state

Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/PaxosService.cc

index d07637eead492b10223b071f232803f851ff080b..783af679736127abf62fa99c99033093d3618527 100644 (file)
@@ -109,7 +109,7 @@ void PaxosService::_commit()
   dout(7) << "_commit" << dendl;
   update_from_paxos();   // notify service of new paxos state
 
-  if (mon->is_leader()) {
+  if (mon->is_leader() && paxos->is_active()) {
     dout(7) << "_commit creating new pending" << dendl;
     if (!have_pending) {
       create_pending();
@@ -180,7 +180,8 @@ void PaxosService::_active()
   update_from_paxos();
 
   // create pending state?
-  if (mon->is_leader()) {
+  if (mon->is_leader() && paxos->is_active()) {
+    dout(7) << "_active creating new pending" << dendl;
     if (!have_pending) {
       create_pending();
       have_pending = true;