From: Sage Weil Date: Thu, 18 Jun 2009 18:19:47 +0000 (-0700) Subject: osd: track last_complete_ondisk over pushes, too. X-Git-Tag: v0.9~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=754e686cdf2923a41aae0573048550c0065b229c;p=ceph.git osd: track last_complete_ondisk over pushes, too. --- diff --git a/src/osd/PG.h b/src/osd/PG.h index 6017008e8e91..9cfb7ed6905a 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -995,6 +995,9 @@ inline ostream& operator<<(ostream& out, const PG& pg) } } + if (pg.last_complete_ondisk != pg.info.last_complete) + out << " lcod " << pg.last_complete_ondisk; + if (pg.get_role() == 0) { out << " mlcod " << pg.min_last_complete_ondisk; if (!pg.have_master_log) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index cd1892884229..a71bf2b9fbf6 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2547,6 +2547,31 @@ void ReplicatedPG::sub_op_pull(MOSDSubOp *op) } +struct C_OSD_Commit : public Context { + ReplicatedPG *pg; + epoch_t same_since; + eversion_t last_complete; + C_OSD_Commit(ReplicatedPG *p, epoch_t ss, eversion_t lc) : pg(p), same_since(ss), last_complete(lc) { + pg->get(); + } + void finish(int r) { + pg->lock(); + pg->_committed(same_since, last_complete); + pg->unlock(); + pg->put(); + } +}; + +void ReplicatedPG::_committed(epoch_t same_since, eversion_t last_complete) +{ + if (same_since == info.history.same_since) { + dout(10) << "_committed last_complete " << last_complete << " now ondisk" << dendl; + last_complete_ondisk = last_complete; + } else { + dout(10) << "_committed pg has changed, not touching last_complete_ondisk" << dendl; + } +} + /** op_push * NOTE: called from opqueue. */ @@ -2699,7 +2724,8 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op) // apply to disk! write_info(t); - unsigned r = osd->store->apply_transaction(t); + unsigned r = osd->store->apply_transaction(t, new C_OSD_Commit(this, info.history.same_since, + info.last_complete)); assert(r == 0); osd->logger->inc(l_osd_r_pull); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 5b3eaba82293..8c0df019e8f8 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -428,6 +428,10 @@ protected: void sub_op_push_reply(MOSDSubOpReply *reply); void sub_op_pull(MOSDSubOp *op); + void _committed(epoch_t same_since, eversion_t lc); + friend class C_OSD_Commit; + + // -- scrub -- int _scrub(ScrubMap& map, int& errors, int& fixed);