From 2fb73bddb739c6a53d9884e71895eadcc93a2eab Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 8 Nov 2011 13:09:13 -0800 Subject: [PATCH] paxos: fix race between active and commit 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 --- src/mon/PaxosService.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 4525ae4c5c225..552ffe973fdc1 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -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(); } -- 2.39.5