Skip to content

Python SDK async PITR exposes wildcard markers instead of None #30943

Closed

Description

@MatrixAdventurer

Bug

AsyncPitrManager leaks MatrixOne's SHOW PITR wildcard marker (*) through the public Pitr model for non-applicable account, database, and table scopes. The synchronous manager already normalizes the same values to None, and the model declares these fields as Optional[str].

Reproduction

result.rows = [('cluster_pitr', created, modified, 'cluster', '*', '*', '*', 1, 'd')]
pitr = await AsyncPitrManager(client).get('cluster_pitr')
assert pitr.account_name is None  # currently receives '*'

Impact

Callers of the async SDK must special-case an undocumented storage/display sentinel and observe behavior inconsistent with the synchronous API.

Proposed fix

Normalize * to None in the async row parser exactly as the synchronous parser does, with regression coverage through the public async get() path.

Activity

  1. Ariznawlll commented on Oct 24, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:main
    • commit:6fb6531432aaec8c1fbd98a30364941559e0e1d6
    • 修复:PR fix(python-sdk): normalize async PITR wildcard scopes #30944,merge commit 564d02384605c245586a61bf76db58b3d9106976,已确认是上述官方 main 的祖先。
    • 部署方式:隔离工作树中的 Python SDK 源码,Python 3.11 虚拟环境;本问题限定为 SDK 对 SHOW PITR 结果行的映射,使用公共 AsyncPitrManager.get/list 与模拟返回行,不将其描述为真实 PITR 恢复测试。
    • 测试日期:2026-10-24。

    原问题验证

    将 cluster PITR 返回行的 account/database/table 三个 * 标记交给公共异步 get() 和 list();三轮均得到 (None, None, None),没有泄漏 *。同一批次还检查 account、database、table 四级:预期适用字段保留原值、不适用字段转 None;get 与 list 全部一致,3/3 轮通过。

    Happy Path 覆盖

    1. cluster:*/*/* → None/None/None;account:acc/*/* → acc/None/None。
    2. database:acc/db/* → acc/db/None;table:acc/db/tab → acc/db/tab。以上公共异步 get/list 路径每轮均逐字段断言。
    3. 当前 main 上 tests/offline/test_pitr.py 与 tests/offline/test_cdc_sql.py 合计 74 项,重复运行 3 轮均通过;其中 PITR 文件包含原异步 get() 的三个 None 断言。

    Unhappy Path 覆盖

    1. get('missing') 收到空行时仍抛 PitrError,3/3;错误输入未被伪装成带空 scope 的有效 PITR。

    白盒验证

    核对修复只在异步 _row_to_pitr 对三个 scope 字段执行与同步路径相同的 * → None 映射。该问题是 Python SDK 行映射,不涉及 Go 内部并发/fault;未运行 Go race。

    回归测试

    PR #30944 已包含 clients/python/tests/offline/test_pitr.py 中的公共异步 get() 回归。PR 的 Python SDK offline CI 在 Python 3.10、3.11、3.12 与所列 SQLAlchemy 组合均成功,例如 Python 3.10 / SQLAlchemy 2.0。online CI 为 SKIPPED,未声称运行完整在线矩阵。此缺陷只能由 SDK 模型映射断言验证,MOTR SQL 无法观察 Python None,不另加重复 MOTR case。

    测试证据

    隔离工作树命令:PYTHONPATH=. /private/tmp/mo-sdk-qa-1HFPSJ/venv/bin/python -m pytest -q -o addopts='' tests/offline/test_pitr.py tests/offline/test_cdc_sql.py,结果 74 passed in 0.37s;同组测试先前重复 3 轮输出全部 74 个通过标记。公共 get/list 四级 scope 加缺失名称断言输出 PASS public async get/list 4 scopes and missing PITR,连续 3 轮。

    测试结论

    测试通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions