]> git.apps.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)
committerSage Weil <sage@inktank.com>
Mon, 4 Mar 2013 21:54:06 +0000 (13:54 -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>
(cherry picked from commit 62999ea2d362b32dfc86a15dcb03b06fb5cb0572)

src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index a8b16da3126406d227e22a0de857d5aed843f422..6d6f8b8f390062754fab3caf394ac520a04c1cf0 100644 (file)
@@ -1750,7 +1750,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);
@@ -3239,7 +3239,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 ec3d4664a90796505c552c2303a78d69eb97c714..c32f832218952a41e26da0c5db5c639f33013165 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 134a612d7bd5f5a727cd94873864a8c5046a33a9..9e1c38fd1342a30b0b4b307c771b25bd7884c6ec 100644 (file)
@@ -4724,7 +4724,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);
@@ -4766,7 +4766,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
@@ -5799,7 +5799,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 0277e7f4b382c856fa9ba35c7acf495bdf44ba9f..c6e15058b47e9b4401136bdf022dac45b515e562 100644 (file)
@@ -917,7 +917,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();