Repository navigation
Description
DRAFT 3 (SDK, 2026-10-27) — candidate issue, not yet filed
Title: [Bug]: AsyncRestoreManager in async_client.py duplicates the obsolete FROM SNAPSHOT restore SQL (parallel copy of the #31190 defect)
Description
#31190 filed that RestoreManager/AsyncRestoreManager in restore.py (and pitr.py) emit the long-removed RESTORE ... FROM SNAPSHOT syntax. Audit today found the defect also lives in a second, independent copy: matrixone/async_client.py contains its own hand-duplicated class AsyncRestoreManager (lines ~262-346) with the identical dead grammar:
# async_client.py:272
sql = f"RESTORE CLUSTER FROM SNAPSHOT {self.client._escape_identifier(snapshot_name)}"
# async_client.py:283 onward — RESTORE ACCOUNT ... FROM SNAPSHOT ... [TO ACCOUNT ...]This is a copy-pasted duplicate of restore.py's manager (different type, different module) rather than an import — so any fix landing in restore.py/pitr.py will not touch the async_client.py copy, and the async API will remain broken (all four restore entry points: cluster, tenant, database, table) even after the linked issue is closed.
For completeness, the same duplication audit on the snapshot-creating side shows the async surface also embeds clone helpers (clone_table, clone_table_with_snapshot, clone_database, ... in async_client.py) whose SQL re-implements the clone builders — worth re-using one builder module instead, but those aren't broken per se; the restore copy is the concrete defect.
Reproduction
from matrixone.async_client import AsyncClient
ac = AsyncClient()
await ac.connect(...)
await ac.restore.restore_table("snap", "acc", "db", "t")
# server: ERROR 1064 ... near " SNAPSHOT `snap`" (same as #31190 evidence)Or statically: grep -n "FROM SNAPSHOT" matrixone/async_client.py → 8 hits, all inside the duplicated AsyncRestoreManager.
Impact
- Async users (FastAPI/aiohttp workloads are the SDK's flagship use case) hit exactly the same 1064 wall as in [Bug]: Python SDK RestoreManager emits obsolete 'FROM SNAPSHOT' syntax — all restore_table/database/tenant/cluster methods fail with 1064 #31190 — and the eventual fix, if applied only to restore.py, leaves async broken while the issue shows closed. Filed as a separate issue so the fix PR can enumerate both copies.
- The code duplication itself is the root cause: the same canonical SQL lives in ≥3 files (restore.py, async_client.py, pitr.py), so every grammar change multiplies the risk. A follow-up refactor note: single source of truth for restore SQL + tests asserting parity between sync/async emission.
Expected behavior
Fix the grammar in the async_client.py copy along with restore.py/pitr.py (or better: delete the duplicate and re-export through a shared builder so it cannot diverge). Regression test: one async test asserting the emitted SQL matches the current server grammar (RESTORE DATABASE ...{snapshot="..."}), or a live restore round-trip through the async client.
Activity
XuPeng-SH commentedon Oct 28, 2026
Consolidated into #31190. The original report and reproduction remain here, and its additional acceptance cases are recorded in #31190. Closing as a duplicate only consolidates tracking; it does not mean the defect has been fixed.