From: Sage Weil Date: Sun, 22 Oct 2017 03:16:27 +0000 (-0500) Subject: osd/PG: _update_calc_stats: backfill targets do not always affect degraded X-Git-Tag: v13.0.1~436^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d0213e3d37094185ceaac61553c401a0fc207112;p=ceph.git osd/PG: _update_calc_stats: backfill targets do not always affect degraded Our progress on a backfill target should only count toward degraded if the target is needed in order for us to reach the target pool size. If we have remapped other complete copies, we can backfill and not be degraded at all. And we may be some combination of the two if there are multiple backfill targets; use the target(s) with the most objects. Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 6bae2a746c20f..32efb9118dea4 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2633,6 +2633,9 @@ void PG::_update_calc_stats() } } + // Objects backfilled, sorted by # objects. + set> backfill_target_objects; + assert(!actingbackfill.empty()); for (set::iterator i = actingbackfill.begin(); i != actingbackfill.end(); @@ -2662,10 +2665,24 @@ void PG::_update_calc_stats() misplaced += osd_objects; } else { // If this peer has more objects then it should, ignore them - int64_t osd_backfilled = MIN(num_objects, peer_info[p].stats.stats.sum.num_objects); - // Include computed backfilled objects on up nodes - object_copies += osd_backfilled; - backfilled += osd_backfilled; + int64_t osd_backfilled = MIN(num_objects, + peer_info[p].stats.stats.sum.num_objects); + backfill_target_objects.insert(make_pair(osd_backfilled, p)); + backfilled += osd_backfilled; + } + } + + // Only include backfill targets below pool size into the object_copies + // count. Use the most-full targets. + int num_backfill_shards_seen = 0; + for (auto i = backfill_target_objects.rbegin(); + i != backfill_target_objects.rend(); + ++i) { + if (actingset.size() + num_backfill_shards_seen < pool.info.size) { + object_copies += i->first; + ++num_backfill_shards_seen; + } else { + break; } }