Add an easy mechanism for a prepare method to force an immediate proposal.
(Otherwise they have to ensure that a future call to should_propose
returns true with delay==0.0, which is a bit more work for them.)
Signed-off-by: Sage Weil <sage@redhat.com>
return true;
}
+ if (need_immediate_propose) {
+ dout(10) << __func__ << " forced immediate propose" << dendl;
+ need_immediate_propose = false;
+ propose_pending();
+ return true;
+ }
+
double delay = 0.0;
if (!should_propose(delay)) {
dout(10) << " not proposing" << dendl;
*/
bool proposing;
- protected:
+ bool need_immediate_propose = false;
+
+protected:
/**
* Services implementing us used to depend on the Paxos version, back when
* each service would have a Paxos instance for itself. However, now we only
*/
virtual bool should_propose(double &delay);
+ /**
+ * force an immediate propose.
+ *
+ * This is meant to be called from prepare_update(op).
+ */
+ void force_immediate_propose() {
+ need_immediate_propose = true;
+ }
+
/**
* @defgroup PaxosService_h_courtesy Courtesy functions
*