From db0bdc43077ed35327c643331403174b7ffbaab7 Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Thu, 22 Apr 2021 14:56:37 +1000 Subject: [PATCH] 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) --- src/pybind/mgr/insights/module.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index 3566ffb78a6b0..eb07527171587 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -29,6 +29,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""" -- 2.39.5