From: Guang Yang Date: Thu, 26 Feb 2015 08:13:12 +0000 (+0000) Subject: osd: fix negative degraded objects during backfilling X-Git-Tag: v9.0.0~243^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3803%2Fhead;p=ceph.git osd: fix negative degraded objects during backfilling When there is deleting requests during backfilling, the reported number of degraded objects could be negative, as the primary's num_objects is the latest (locally) but the number for replicas might not reflect the deletings. A simple fix is to ignore the negative subtracted value. Signed-off-by: Guang Yang --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5d0a4fec6e2..cd671ca4260 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2297,7 +2297,7 @@ void PG::_update_calc_stats() // a degraded objects has fewer replicas or EC shards than the // pool specifies - uint64_t degraded = 0; + int64_t degraded = 0; // if acting is smaller than desired, add in those missing replicas if (acting.size() < target) @@ -2319,7 +2319,9 @@ void PG::_update_calc_stats() degraded += peer_missing[*i].num_missing(); // not yet backfilled - degraded += num_objects - peer_info[*i].stats.stats.sum.num_objects; + int64_t diff = num_objects - peer_info[*i].stats.stats.sum.num_objects; + if (diff > 0) + degraded += diff; } info.stats.stats.sum.num_objects_degraded = degraded; info.stats.stats.sum.num_objects_unfound = get_num_unfound();