From: Sage Weil Date: Thu, 18 Jun 2009 23:38:39 +0000 (-0700) Subject: osd: don't trim pg log if degraded X-Git-Tag: v0.9~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e33bf129bdb2fbea9b637f832cdf8b59065aff5;p=ceph.git osd: don't trim pg log if degraded Also be a bit more verbose about pg_trim_to changes. --- diff --git a/src/osd/PG.h b/src/osd/PG.h index 029576514c15..52ce2324a1e7 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -847,6 +847,7 @@ public: bool is_replay() const { return state_test(PG_STATE_REPLAY); } //bool is_complete() { return state_test(PG_STATE_COMPLETE); } bool is_clean() const { return state_test(PG_STATE_CLEAN); } + bool is_degraded() const { return state_test(PG_STATE_DEGRADED); } bool is_stray() const { return state_test(PG_STATE_STRAY); } bool is_scrubbing() const { return state_test(PG_STATE_SCRUBBING); } diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 288168943b0a..06db0dd5a928 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -415,10 +415,13 @@ void ReplicatedPG::do_pg_op(MOSDOp *op) void ReplicatedPG::calc_trim_to() { - if (is_clean() || - log.top.version - log.bottom.version > info.stats.num_objects) { - pg_trim_to = min_last_complete_ondisk; - if (pg_trim_to != eversion_t()) { + if (!is_degraded() && + (is_clean() || + log.top.version - log.bottom.version > info.stats.num_objects)) { + if (min_last_complete_ondisk != eversion_t() && + min_last_complete_ondisk != pg_trim_to) { + dout(10) << "calc_trim_to " << pg_trim_to << " -> " << min_last_complete_ondisk << dendl; + pg_trim_to = min_last_complete_ondisk; assert(pg_trim_to >= log.bottom); assert(pg_trim_to <= log.top); }