From: Brad Hubbard Date: Thu, 22 Apr 2021 04:56:37 +0000 (+1000) Subject: pybind/mgr/insights: Don't persist report data X-Git-Tag: v15.2.15~34^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e3a65625c2a9662b43423f9b98824fc86e76bc24;p=ceph.git pybind/mgr/insights: Don't persist report data Don't store health reports in rocksdb. Fixes: https://tracker.ceph.com/issues/48269 Signed-off-by: Brad Hubbard (cherry picked from commit de66522517edd6f7baf19cc0660478502d3c25e8) --- diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index a640d85b74691..af2a51309d4d8 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -42,6 +42,26 @@ class Module(MgrModule): # health history tracking self._pending_health = [] self._health_slot = None + self._store = {} + + # The following three functions, get_store, set_store, and get_store_prefix + # mask the functions defined in the parent to avoid storing large keys + # persistently to disk as that was proving problematic. Long term we may + # implement a different mechanism to make these persistent. When that day + # comes it should just be a matter of deleting these three functions. + def get_store(self, key): + return self._store.get(key) + + def set_store(self, key, value): + if value is None: + if key in self._store: + del self._store[key] + else: + self._store[key] = value + + def get_store_prefix(self, prefix): + return { k: v for k, v in self._store.items() if k.startswith(prefix) } + def notify(self, ttype, ident): """Queue updates for processing"""