Skip to content

Transactions: FOR UPDATE SKIP LOCKED unsupported #23126

Closed

Description

@dengn

Description

SELECT ... FOR UPDATE SKIP LOCKED 是 MySQL 8.0 的常用并发控制语法,用于跳过已加锁行。但在 MatrixOne 中该语句无法解析,始终报 syntax error ... near " SKIP LOCKED"。

Error Message

ERROR 1064 (HY000) at line 8: SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 69 near " SKIP LOCKED";

Related Table DDL

CREATE TABLE temp_txn_skip_2279 AS
SELECT id, company_id FROM company_patent WHERE company_id IS NOT NULL LIMIT 10;

Reproduction SQL

START TRANSACTION;
SELECT id FROM temp_txn_skip_2279 ORDER BY id LIMIT 5 FOR UPDATE;
COMMIT;

START TRANSACTION;
SELECT id FROM temp_txn_skip_2279 ORDER BY id LIMIT 5 FOR UPDATE SKIP LOCKED;
COMMIT;

Impact

  • 无法构建基于任务队列的多会话并发消费模型。
  • 与 MySQL 8.0 的语义不兼容,导致作业调度/分布式锁业务无法迁移。

Expected Behavior

MySQL 支持 SKIP LOCKED/ NOWAIT 扩展。MatrixOne 应支持解析并实现跳过已锁行的逻辑,即使内部 fallback,也应保留语法兼容。

References

  • 报告: report_test_batch_228_txn_boundary_20251124_154800.md Case 2279 等 10 个用例。

Activity

  1. fengttt commented on Nov 24, 2025

    @fengttt
    Contributor

    Won't fix.

  2. dengn commented on Oct 11, 2026

    @dengn
    ContributorAuthor

    Application compatibility replay on official v4.2.5

    Branch Name

    Official stable release v4.2.5; current main has not been retested for this report.

    Commit ID

    1a44f3db3056e32975fde86ca0ab69a094996a3f (SELECT git_version() returns 1a44f3d).

    Other Environment Information

    Linux x86_64 standalone official binary, 4 CPUs, ~16 GiB container memory limit. SELECT VERSION() = 8.0.30-MatrixOne-v4.2.5. PyMySQL 1.2.3 client. Only fresh owned test schemas were used for SQL probes; the native Airflow diagnostic is a read-only SELECT against the retained test fixture.

    Actual Behavior

    Native application impact: 原生调度器 SQL 失败。

    ERROR 1064: SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 39 near " OF lock_probe";
    SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 41 near " SKIP LOCKED";
    SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 43 near " NOWAIT";
    

    Expected Behavior

    Support FOR UPDATE OF / SKIP LOCKED / NOWAIT where MySQL-compatible, or expose separate unsupported capabilities explicitly. Blocking FOR UPDATE cannot preserve SKIP LOCKED/NOWAIT semantics.

    Steps to Reproduce

    Use a dedicated fresh test schema (create one without DROP DATABASE), then run:

    CREATE TABLE lock_probe(id INT PRIMARY KEY);
    
    SELECT id FROM lock_probe FOR UPDATE OF lock_probe;
    
    SELECT id FROM lock_probe FOR UPDATE SKIP LOCKED;
    
    SELECT id FROM lock_probe FOR UPDATE NOWAIT;

    Additional information

    • Native applications: Airflow.
    • This is release v4.2.5 evidence, not a claim that the same failure remains on current main.
    • Observation family MO-OBS-017. App-side workarounds do not constitute an engine fix.
    • All disclosed values are owned synthetic fixtures; no passwords, tokens, application cookies or raw private logs are attached.
  3. Ariznawlll commented on Oct 29, 2026

    @Ariznawlll
    Collaborator

    Regression/continuity alert: this issue is CLOSED, but SELECT ... FOR UPDATE SKIP LOCKED still fails with 1064 on current main (verified 2026-10-29 on main c6683bd2f5, built locally today, dual-CN launch):

    SELECT id FROM t WHERE id = 1 FOR UPDATE SKIP LOCKED;
    -- ERROR 1064 (42000): SQL parser error ... near " SKIP LOCKED"
    
    -- neighbors on the same build:
    SELECT ... FOR UPDATE NOWAIT;     -- parses and executes ✓
    SELECT ... FOR SHARE;             -- ✓ (and LOCK IN SHARE MODE ✓)
    SELECT ... FOR UPDATE OF t;       -- 1064 (tracked separately in #30627)

    The feature family around it (NOWAIT at least) landed, so if SKIP LOCKED was closed as fixed via that work, the fix did not cover the SKIP LOCKED branch. If it was closed as won't-fix, an explicit note would help — queue-style workloads (job tables, outbox pattern, task schedulers) use SKIP LOCKED as the canonical MySQL 8 non-blocking dequeue idiom; today those workloads parse-fail against MO with no functional substitute.

    Happy to move this to a fresh issue if the closed one has release-management semantics; flagging here since the original report already contains the full context.

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