]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
paxos: fix race between active and commit
authorSage Weil <sage@newdream.net>
Tue, 8 Nov 2011 21:09:13 +0000 (13:09 -0800)
committerSage Weil <sage@newdream.net>
Tue, 8 Nov 2011 21:09:13 +0000 (13:09 -0800)
If paxos reproposes an old learned value, we have a C_Active waiter, and
also a commit in progress.

When we reach quorum, paxos goes active, and _active() creates a new
pending.  A bit later, the _commit callback goes, and we already have that
pending value ready.

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

index 4525ae4c5c225020523b45571300e10123b3f99c..552ffe973fdc1f08656a3766977d6ebe35e2efe2 100644 (file)
@@ -111,9 +111,10 @@ void PaxosService::_commit()
 
   if (mon->is_leader()) {
     dout(7) << "_commit creating new pending" << dendl;
-    assert(have_pending == false);
-    create_pending();
-    have_pending = true;
+    if (!have_pending) {
+      create_pending();
+      have_pending = true;
+    }
 
     committed();
   }