]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: fix pg_sum_old not copied correctly
authorYao Zongyou <yaozongyou@vip.qq.com>
Thu, 24 Jan 2019 07:41:30 +0000 (15:41 +0800)
committerYao Zongyou <yaozongyou@vip.qq.com>
Thu, 24 Jan 2019 07:41:30 +0000 (15:41 +0800)
`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 <yaozongyou@vip.qq.com>
src/mon/PGMap.cc

index b4894c035e8e1e9249fd86982051fe4ccae028cc..133fcdb8cb7c384a1d8ac2ab60bda84772f6713c 100644 (file)
@@ -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<int32_t, pool_stat_t> 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;