]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/progress: clamp pg recovery ratio to 0
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 19 Jul 2019 08:43:57 +0000 (16:43 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 22 Jul 2019 03:07:08 +0000 (11:07 +0800)
There were times that I could observe the num_bytes_recovered field
of pg_stat_t may decrease, e.g., due to the primary switching
(or similar).
Clamp the pg recovery ratio to 0 too since it might go negative.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/pybind/mgr/progress/module.py

index 1a529a8121335503d6bc2e82b1d6bd704f9dfd36..1c940376ed2829b37a5eea9f4c358e2f3461ebfc 100644 (file)
@@ -237,6 +237,7 @@ class PgRecoveryEvent(Event):
                         # exceed the contents of the PG (moment in time), we
                         # must clamp this
                         ratio = min(ratio, 1.0)
+                        ratio = max(ratio, 0.0)
 
                     else:
                         # Dataless PGs (e.g. containing only OMAPs) count