]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/progress: Skip pg_summary update if _events dict is empty. 36075/head
authorManuel Lausch <manuel.lausch@1und1.de>
Wed, 8 Jul 2020 09:42:37 +0000 (11:42 +0200)
committerNathan Cutler <ncutler@suse.com>
Mon, 13 Jul 2020 20:08:50 +0000 (22:08 +0200)
The get call of pg_stats and pg_ready are expensive and are not necessary in this case. This avoids blocking other modules like the prometheus module

Fixes: https://tracker.ceph.com/issues/46416
Signed-off-by: Manuel Lausch <manuel.lausch@1und1.de>
(cherry picked from commit 1031edd89d09d18812a3f11b7cbb2ce6759bad13)

src/pybind/mgr/progress/module.py

index fa66e40890e960d2a8d1cec3f0cbe5699179a2af..85ed2f0269fc19c488854dbc174ca67504ee84a7 100644 (file)
@@ -454,6 +454,10 @@ class Module(MgrModule):
             ))
             self._osdmap_changed(old_osdmap, self._latest_osdmap)
         elif notify_type == "pg_summary":
+            # if there are no events we will skip this here to avoid 
+            # expensive get calls
+            if len(self._events) == 0:
+                return
             data = self.get("pg_stats")
             ready = self.get("pg_ready")
             for ev_id, ev in self._events.items():