]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos: move post-commit finish work into commit_finish()
authorSage Weil <sage@redhat.com>
Sun, 17 Aug 2014 05:29:04 +0000 (22:29 -0700)
committerSage Weil <sage@redhat.com>
Wed, 27 Aug 2014 21:36:07 +0000 (14:36 -0700)
The main change here is that we are merging the singleton and clustered
finish code together.  This is mostly a code shuffle, except for one
semantic change: we now trigger the commit waiters before finish_round()
in the singleton case, whereas before we did not.  I don't think there
was a specific reason why it differed from the clustered case.

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

index f3ddb5ed8467d1bc7411473f7b5e7a077e0062f8..5c0ce2faa2a08e67b2bdc48d403ad4361d605e70 100644 (file)
@@ -666,15 +666,6 @@ void Paxos::begin(bufferlist& v)
   if (mon->get_quorum().size() == 1) {
     // we're alone, take it easy
     commit_start();
-    if (do_refresh()) {
-      assert(is_updating());  // we can't be updating-previous with quorum of 1
-      commit_proposal();
-      finish_round();
-      finish_contexts(g_ceph_context, waiting_for_active);
-      finish_contexts(g_ceph_context, waiting_for_commit);
-      finish_contexts(g_ceph_context, waiting_for_readable);
-      finish_contexts(g_ceph_context, waiting_for_writeable);
-    }
     return;
   }
 
@@ -794,27 +785,6 @@ void Paxos::handle_accept(MMonPaxos *accept)
     // yay, commit!
     dout(10) << " got majority, committing, done with update" << dendl;
     commit_start();
-    if (!do_refresh())
-      goto out;
-    if (is_updating())
-      commit_proposal();
-    finish_contexts(g_ceph_context, waiting_for_commit);
-
-    // cancel timeout event
-    mon->timer.cancel_event(accept_timeout_event);
-    accept_timeout_event = 0;
-
-    // yay!
-    extend_lease();
-
-    assert(g_conf->paxos_kill_at != 10);
-
-    finish_round();
-
-    // wake people up
-    finish_contexts(g_ceph_context, waiting_for_active);
-    finish_contexts(g_ceph_context, waiting_for_readable);
-    finish_contexts(g_ceph_context, waiting_for_writeable);
   }
 
  out:
@@ -905,6 +875,29 @@ void Paxos::commit_finish()
   new_value.clear();
 
   remove_legacy_versions();
+
+  if (do_refresh()) {
+    if (is_updating())
+      commit_proposal();
+
+    finish_contexts(g_ceph_context, waiting_for_commit);
+
+    if (mon->get_quorum().size() > 1) {
+      // cancel timeout event
+      mon->timer.cancel_event(accept_timeout_event);
+      accept_timeout_event = 0;
+      extend_lease();
+    }
+
+    assert(g_conf->paxos_kill_at != 10);
+
+    finish_round();
+
+    // wake (other) people up
+    finish_contexts(g_ceph_context, waiting_for_active);
+    finish_contexts(g_ceph_context, waiting_for_readable);
+    finish_contexts(g_ceph_context, waiting_for_writeable);
+  }
 }