From 3c779f7d2aefc9a68bceb3ec258e0425c53233d2 Mon Sep 17 00:00:00 2001 From: Yao Zongyou Date: Thu, 24 Jan 2019 15:41:30 +0800 Subject: [PATCH] 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 --- src/mon/PGMap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index b4894c035e8..133fcdb8cb7 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; -- 2.39.5