From: Sage Weil Date: Mon, 8 Jul 2013 22:57:48 +0000 (-0700) Subject: mon: be smarter about calculating last_epoch_clean lower bound X-Git-Tag: v0.67-rc1~131^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc0006deee3153e06ddd220bf8a40358ba830135;p=ceph.git mon: be smarter about calculating last_epoch_clean lower bound We need to take PGs whose mapping has not changed in a long time into account. For them, the pg state will indicate it was clean at the time of the report, in which case we can use that as a lower-bound on their actual latest epoch clean. If they are not currently clean (at report time), use the last_epoch_clean value. Fixes: #5519 Signed-off-by: Sage Weil --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 8be36c857bd7..c405b403f395 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -409,10 +409,11 @@ epoch_t PGMap::calc_min_last_epoch_clean() const if (pg_stat.empty()) return 0; hash_map::const_iterator p = pg_stat.begin(); - epoch_t min = p->second.last_epoch_clean; + epoch_t min = p->second.get_effective_last_epoch_clean(); for (++p; p != pg_stat.end(); ++p) { - if (p->second.last_epoch_clean < min) - min = p->second.last_epoch_clean; + epoch_t lec = p->second.get_effective_last_epoch_clean(); + if (lec < min) + min = lec; } return min; } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index a039a3dd5801..8e30bb14e1dd 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -947,6 +947,16 @@ struct pg_stat_t { mapping_epoch(0) { } + epoch_t get_effective_last_epoch_clean() const { + if (state & PG_STATE_CLEAN) { + // we are clean as of this report, and should thus take the + // reported epoch + return reported.epoch; + } else { + return last_epoch_clean; + } + } + void add(const pg_stat_t& o) { stats.add(o.stats); log_size += o.log_size;