From: Sage Weil Date: Fri, 5 May 2017 16:21:09 +0000 (-0400) Subject: mon/Paxos: add plug/unplug X-Git-Tag: v12.1.0~266^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de3fe89ebf5198d3191c5fefefa4adafb0e50fb8;p=ceph.git mon/Paxos: add plug/unplug Simple mechanism to prevent and immediate commit (until the caller does more stuff, presumably). Signed-off-by: Sage Weil --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 8ba73118e0f0..08741b17170c 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -1539,7 +1539,10 @@ MonitorDBStore::TransactionRef Paxos::get_pending_transaction() bool Paxos::trigger_propose() { - if (is_active()) { + if (plugged) { + dout(10) << __func__ << " plugged, not proposing now" << dendl; + return false; + } else if (is_active()) { dout(10) << __func__ << " active, proposing now" << dendl; propose_pending(); return true; diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index 94046c86f1b1..4ba84e6cc45b 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -614,6 +614,11 @@ private: */ bool trimming; + /** + * true if we want trigger_propose to *not* propose (yet) + */ + bool plugged = false; + /** * @defgroup Paxos_h_callbacks Callback classes. * @{ @@ -1194,7 +1199,19 @@ public: return true; } - + + bool is_plugged() const { + return plugged; + } + void plug() { + assert(plugged == false); + plugged = true; + } + void unplug() { + assert(plugged == true); + plugged = false; + } + // read /** * @defgroup Paxos_h_read_funcs Read-related functions