]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG,ReplicatedPG: use pg_has_reset_since to discard old async events
authorSamuel Just <sam.just@inktank.com>
Mon, 25 Feb 2013 21:28:31 +0000 (13:28 -0800)
committerSamuel Just <sam.just@inktank.com>
Mon, 25 Feb 2013 21:30:11 +0000 (13:30 -0800)
Local async events are obsolete if the pg is deleting or if the
epoch at which they were created is prior to last_peering_reset.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 36266f5f2b6baa49b5710a9da05eb36f40bad6c6..4ff5242277b443acfa44e71be76fdbf2b6fdc087 100644 (file)
@@ -1765,7 +1765,7 @@ void PG::replay_queued_ops()
 void PG::_activate_committed(epoch_t e)
 {
   lock();
-  if (e < last_peering_reset) {
+  if (pg_has_reset_since(e)) {
     dout(10) << "_activate_committed " << e << ", that was an old interval" << dendl;
   } else if (is_primary()) {
     peer_activated.insert(osd->whoami);
@@ -3254,7 +3254,7 @@ void PG::build_scrub_map(ScrubMap &map)
   _scan_list(map, ls, false);
   lock();
 
-  if (epoch < last_peering_reset) {
+  if (pg_has_reset_since(epoch)) {
     dout(10) << "scrub  pg changed, aborting" << dendl;
     return;
   }
index ed85c4e2946e40d41b9e8ac8d33581819f6afdef..32e78a435a492543e33732b9da2ac144b89994bf 100644 (file)
@@ -1841,6 +1841,10 @@ public:
                   list<Context *> *on_applied,
                   list<Context *> *on_safe);
   void set_last_peering_reset();
+  bool pg_has_reset_since(epoch_t e) {
+    assert(is_locked());
+    return deleting || e < get_last_peering_reset();
+  }
 
   void update_history_from_master(pg_history_t new_history);
   void fulfill_info(int from, const pg_query_t &query, 
index d079f1f27b8e2a7553ac6ee7db6e24c5c782bf7a..220d73bd6267c8e81ac00f9db3531e04cbe3607e 100644 (file)
@@ -4542,7 +4542,7 @@ void ReplicatedPG::sub_op_modify_applied(RepModify *rm)
   rm->op->mark_event("sub_op_applied");
   rm->applied = true;
 
-  if (rm->epoch_started >= last_peering_reset) {
+  if (!pg_has_reset_since(rm->epoch_started)) {
     dout(10) << "sub_op_modify_applied on " << rm << " op " << *rm->op->request << dendl;
     MOSDSubOp *m = (MOSDSubOp*)rm->op->request;
     assert(m->get_header().type == MSG_OSD_SUBOP);
@@ -4584,7 +4584,7 @@ void ReplicatedPG::sub_op_modify_commit(RepModify *rm)
   rm->op->mark_commit_sent();
   rm->committed = true;
 
-  if (rm->epoch_started >= last_peering_reset) {
+  if (!pg_has_reset_since(rm->epoch_started)) {
     // send commit.
     dout(10) << "sub_op_modify_commit on op " << *rm->op->request
             << ", sending commit to osd." << rm->ackerosd
@@ -5617,7 +5617,7 @@ void ReplicatedPG::_committed_pushed_object(
   OpRequestRef op, epoch_t epoch, eversion_t last_complete)
 {
   lock();
-  if (epoch >= last_peering_reset) {
+  if (!pg_has_reset_since(epoch)) {
     dout(10) << "_committed_pushed_object last_complete " << last_complete << " now ondisk" << dendl;
     last_complete_ondisk = last_complete;
 
index 701b537c50743937af633c7128c7967521fd92b9..aac728079bd09091c8acef9f809bcebafbff2b34 100644 (file)
@@ -824,7 +824,7 @@ protected:
       epoch_t epoch) : pg(pg), hoid(hoid), epoch(epoch) {}
     void finish(int) {
       pg->lock();
-      if (epoch >= pg->last_peering_reset) {
+      if (!pg->pg_has_reset_since(epoch)) {
        pg->finish_recovery_op(hoid);
       }
       pg->unlock();