diff options
author | Sage Weil <sage@inktank.com> | 2013-07-08 15:57:48 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-12 15:44:51 -0700 |
commit | 62ae39ec8f208cb8f89e43ba844b9a20b4315c61 (patch) | |
tree | bc25a029472954d1ab79307373723cad9a34ead6 | |
parent | da725852190245d2f91b7b21e72baee70e4342bd (diff) | |
download | ceph-62ae39ec8f208cb8f89e43ba844b9a20b4315c61.tar.gz |
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 <sage@inktank.com>
(cherry picked from commit cc0006deee3153e06ddd220bf8a40358ba830135)
-rw-r--r-- | src/mon/PGMap.cc | 7 | ||||
-rw-r--r-- | src/osd/osd_types.h | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 36a35424a20..0feee739fcb 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -360,10 +360,11 @@ epoch_t PGMap::calc_min_last_epoch_clean() const if (pg_stat.empty()) return 0; hash_map<pg_t,pg_stat_t>::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 6a6b16f3188..a7a10307d1f 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -945,6 +945,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; |