]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos: add plug/unplug
authorSage Weil <sage@redhat.com>
Fri, 5 May 2017 16:21:09 +0000 (12:21 -0400)
committerJoao Eduardo Luis <joao@suse.de>
Mon, 5 Jun 2017 14:20:19 +0000 (15:20 +0100)
Simple mechanism to prevent and immediate commit (until the caller does
more stuff, presumably).

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/Paxos.cc
src/mon/Paxos.h

index 8ba73118e0f0a4efb5a2e35ab69c9495c065a430..08741b17170c9b62f22450b2d8b1b75711d02033 100644 (file)
@@ -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;
index 94046c86f1b10263e8f8ece440b7c76f46fa99f4..4ba84e6cc45b57be74910b148b0f5efcbd537d61 100644 (file)
@@ -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