From: Patrick Donnelly Date: Wed, 12 Feb 2025 02:28:40 +0000 (-0500) Subject: pybind/mgr/mgr_module: turn off all automatic transactions X-Git-Tag: v18.2.5~46^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc619ac1860b6c9ee0be31bd6cd25b5b39940f1a;p=ceph.git pybind/mgr/mgr_module: turn off all automatic transactions I misunderstood autocommit=False in prior patches. The sqlite3 binding will still create transactions automatically which confused newer bindings using autocommit. So, turn off automatic transaction management completely to maintain backwards compatibility. Fixes: https://tracker.ceph.com/issues/69912 Signed-off-by: Patrick Donnelly (cherry picked from commit df49652987019d5eeec31c86332d8e69995d931a) --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 93c4458ea428..622ec4e9b2a9 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -1278,10 +1278,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): self.create_mgr_pool() uri = f"file:///{self.MGR_POOL_NAME}:{self.module_name}/main.db?vfs=ceph"; self.log.debug(f"using uri {uri}") - try: - db = sqlite3.connect(uri, check_same_thread=False, uri=True, autocommit=False) # type: ignore[call-arg] - except TypeError: - db = sqlite3.connect(uri, check_same_thread=False, uri=True, isolation_level=None) + db = sqlite3.connect(uri, check_same_thread=False, uri=True, isolation_level=None) # type: ignore[call-arg] # if libcephsqlite reconnects, update the addrv for blocklist with db: cur = db.execute('SELECT json_extract(ceph_status(), "$.addr");')