From c33536685d66b35fc64ad057c5bfc431b6828842 Mon Sep 17 00:00:00 2001 From: Igor Ilic <30923996+dexters1@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:29:36 +0200 Subject: [PATCH] fix: Resolve Kuzu S3 issue (#1235) ## Description Resolve issue with pushing Kuzu DBs to S3 ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin. --- cognee/infrastructure/databases/graph/kuzu/adapter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cognee/infrastructure/databases/graph/kuzu/adapter.py b/cognee/infrastructure/databases/graph/kuzu/adapter.py index 4262178be..2fa01a947 100644 --- a/cognee/infrastructure/databases/graph/kuzu/adapter.py +++ b/cognee/infrastructure/databases/graph/kuzu/adapter.py @@ -42,6 +42,7 @@ class KuzuAdapter(GraphDBInterface): self.connection: Optional[Connection] = None self.executor = ThreadPoolExecutor() self._initialize_connection() + self.KUZU_ASYNC_LOCK = asyncio.Lock() def _initialize_connection(self) -> None: """Initialize the Kuzu database connection and schema.""" @@ -136,6 +137,10 @@ class KuzuAdapter(GraphDBInterface): from cognee.infrastructure.files.storage.S3FileStorage import S3FileStorage s3_file_storage = S3FileStorage("") + + async with self.KUZU_ASYNC_LOCK: + self.connection.execute("CHECKPOINT;") + s3_file_storage.s3.put(self.temp_graph_file, self.db_path, recursive=True) async def pull_from_s3(self) -> None: @@ -145,7 +150,7 @@ class KuzuAdapter(GraphDBInterface): try: s3_file_storage.s3.get(self.db_path, self.temp_graph_file, recursive=True) except FileNotFoundError: - pass + logger.warning(f"Kuzu S3 storage file not found: {self.db_path}") async def query(self, query: str, params: Optional[dict] = None) -> List[Tuple]: """