From: Yao Zongyou Date: Thu, 24 Jan 2019 07:41:30 +0000 (+0800) Subject: mon: fix pg_sum_old not copied correctly X-Git-Tag: v14.1.0~262^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3c779f7d2aefc9a68bceb3ec258e0425c53233d2;p=ceph.git mon: fix pg_sum_old not copied correctly `pg_sum` is accumulated during `PGMap::apply_incremental`, so if we want to make an old copy of it, we should do it at the beginning. Or else, the `pg_sum_deltas` is always zero. Signed-off-by: Yao Zongyou --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index b4894c035e8e..133fcdb8cb7c 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -1094,6 +1094,7 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) ceph_assert(inc.version == version+1); version++; + pool_stat_t pg_sum_old = pg_sum; mempool::pgmap::unordered_map pg_pool_sum_old; pg_pool_sum_old = pg_pool_sum; @@ -1183,7 +1184,6 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc) } } - pool_stat_t pg_sum_old = pg_sum; // skip calculating delta while sum was not synchronized if (!stamp.is_zero() && !pg_sum_old.stats.sum.is_zero()) { utime_t delta_t;