]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: fix MgrModuleRecoverDB to honor its retry budget on db cleanup failure 69699/head
authorAvan Thakkar <athakkar@redhat.com>
Wed, 24 Jun 2026 11:15:51 +0000 (16:45 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Wed, 24 Jun 2026 12:22:39 +0000 (17:52 +0530)
Both close_db() and open_db() during retry were unguarded, so a failure
in either escaped the decorator immediately instead of retrying up to
MAX_DBCLEANUP_RETRIES.

Wrapped both in the same try/except, and logged the
failed attempt.

Fixes: https://tracker.ceph.com/issues/77635
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
src/pybind/mgr/mgr_module.py

index 192eefbf96ee9c296b16c01f5a31b14580d7b7b6..3ba6cb3277ca9225df1d03367faf319a803903cb 100644 (file)
@@ -619,8 +619,13 @@ def MgrModuleRecoverDB(func: Callable) -> Callable:
                 if retries > MAX_DBCLEANUP_RETRIES:
                     raise
                 self.log.debug("attempting reopen of database")
-                self.close_db()
-                self.open_db()
+                try:
+                    self.close_db()
+                    self.open_db()
+                except sqlite3.DatabaseError as e2:
+                    self.log.warning(
+                        f"reopen attempt {retries}/{MAX_DBCLEANUP_RETRIES} failed: {e2}"
+                    )
                 # allow retry of func(...)
     check.__signature__ = inspect.signature(func)  # type: ignore[attr-defined]
     return check