Skip to content

[Compatibility]: user-level lock functions return NULL instead of rejecting a NULL name #28249

Closed

Description

@Ariznawlll

问题描述

MatrixOne 的 GET_LOCK、RELEASE_LOCK、IS_FREE_LOCK 和 IS_USED_LOCK 在 lock name 为 NULL 时都返回 NULL。MySQL 8.3 对四个函数统一返回 3057,明确指出名称为空、NULL 或无法用当前字符集表示。

空字符串和超过 64 字符的名称在 MatrixOne 中已经会报错;NULL 名称绕过了同一校验路径,造成参数行为不一致,也与 MySQL 不兼容。

环境

  • MatrixOne latest main, commit e7bb0572235ec4bac81eb098eb0ad8900f0065ab
  • MySQL 8.3.0(对照)

复现

select get_lock(null,0);
select release_lock(null);
select is_free_lock(null);
select is_used_lock(null);

MatrixOne 行为

四条语句均返回 SQL NULL。

MySQL 8.3.0 行为

四条语句均返回:

ERROR 3057: Incorrect user-level lock name 'NULL'. The name is empty, NULL,
or can not be expressed in the current character-set.

期望行为

NULL lock name 应进入与空名称相同的非法参数路径,并返回 MySQL 兼容错误;不能被函数框架的普通 NULL propagation 提前转换为结果 NULL。

长度边界控制已验证:64 个 ASCII/Unicode 字符可用,65 个字符两端均拒绝;该部分与 MySQL 一致。

Activity

  1. added this to the MO-202609 milestone on Sep 5, 2026
  2. added
    kind/bug
    on Sep 5, 2026
  3. added theissue type on Sep 5, 2026
  4. self-assigned this
    on Sep 5, 2026
  5. XuPeng-SH commented on Sep 12, 2026

    @XuPeng-SH
    Contributor

    Implemented in PR #28783: #28783

    The change maps NULL, empty, embedded-NUL, and invalid-UTF-8 lock names to MySQL error 3057 across GET_LOCK, RELEASE_LOCK, IS_FREE_LOCK, and IS_USED_LOCK. It preserves the existing separate overlength behavior and validates selected vector rows before lock-service side effects, so a bad later name cannot leave earlier rows' effects behind.

    Incremental SCA passed (0 issues). Local UT/BVT runtime verification is still pending: the isolated worktree lacks provenance-stamped cgo/libmo.dylib, and unrelated MatrixOne services are active. Please keep the issue open until exact-head CI verifies the SQL path.

  6. added a commit that references this issue on Sep 12, 2026
    078d077
  7. Ariznawlll commented on Sep 14, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:07b25969bfea9d4b76d3bf05d5b0497e4f36eba0
    • 部署:本地独立 1 CN / 1 TN / 1 LogService;每轮均重新启动服务后执行。
    • 执行:每项 SQL 回归连续 3 轮,输出逐轮一致。

    原问题验证

    • 用户级锁函数的 NULL name 已被拒绝,而非返回 NULL。

    Happy Path 覆盖

    • 覆盖正常 GET_LOCK/RELEASE_LOCK,锁可获取并释放。

    Unhappy Path 覆盖

    • 覆盖 GET_LOCK、RELEASE_LOCK、IS_FREE_LOCK、IS_USED_LOCK 的 NULL name,均稳定返回 3057。

    白盒验证

    • 以 MOTR 固定四个函数的错误路径。

    回归测试

    测试证据

    • 以上结果均在该 main commit 的独立环境获得;每轮无 stderr,三轮结果一致。

    测试结论

    测试通过。

  8. added 6 commits that reference this issue on Sep 17, 2026
    2bd8198
    8a2694d
    ce7e452
    f736ab3
    349a5a6
    af9d639
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions