Repository navigation
Description
Current disposition (2026-09-28)
Optimistic transaction mode is retired. The duplicate-primary-key reproduction below is valid evidence for that old test-only mode, but it is outside the supported product contract and is closed as not planned. It does not block #29400's pessimistic RC work. Keep the aggregate-versus-row-scan discrepancy as a diagnostic observation, not a confirmed bug in supported modes. Reopen only if the same failure is independently reproduced in a supported pessimistic mode or maintainers explicitly restore optimistic mode support.
Scope and environment
Found while validating #29400. This is an existing engine/test-mode bug in an unmodified MatrixOne binary at commit fdcd553b0cfe356679f43d798d645599d9ba375e (SHA256 1d12b91c74f25a83aff68a40a029b67c7de9a6ad4309f21bede8238105332f4b). Fresh disposable standalone service, one CN/TN/LogService, [cn.txn] mode = "optimistic" and isolation = "RC". Optimistic transactions are currently test-only, not a claimed external compatibility mode. The latest main was not independently tested for this bug.
Reproduction
CREATE DATABASE qa_opt_rc_base;
CREATE TABLE qa_opt_rc_base.w (id INT PRIMARY KEY, v INT);
INSERT INTO qa_opt_rc_base.w VALUES (1,1), (2,1);On A, start an explicit transaction and hold it after the no-op update:
BEGIN;
UPDATE qa_opt_rc_base.w SET v=v WHERE id=1;
SELECT SLEEP(3);
COMMIT;While A sleeps, on B run UPDATE qa_opt_rc_base.w SET v=v WHERE id=1;. As an independent control, on C run the same update for id=2. Then, on a fresh connection, run:
SELECT id,v,__mo_rowid FROM qa_opt_rc_base.w ORDER BY id,__mo_rowid;A and B both returned success (A 3.034 s, B 0.022 s); C succeeded in 0.038 s. The scan returned two rows with id=1, with distinct physical rowids ending ...-2 and ...-4. A graceful restart did not remove them: the same row scan still returned both. In the post-restart SQL invocation, however, SELECT COUNT(*),COUNT(DISTINCT __mo_rowid) FROM qa_opt_rc_base.w WHERE id=1 returned 1,1. Thus aggregate and row scan disagree; do not use that count as the uniqueness oracle.
Expected: one visible row per primary key, with either one writer rejected by a write conflict or a serial result. The aggregate should agree with row scans. The disjoint-row control should remain independent.
The same schedule on a separate test-only scratch build with an ordinary mo_catalog witness relation also produced duplicate same-key rows, but the unmodified ordinary-table reproduction above establishes that the problem is not caused by the scratch hook. This is not evidence against the supported pessimistic RC or pessimistic SI modes; those had separate successful conflict probes during #29400 design.
Impact and investigation direction
A same-row no-op UPDATE can appear to provide a lifecycle write barrier in optimistic RC while both writers commit and duplicate primary-key rows become visible. A lifecycle refactor must fail closed for this test-only mode before effects, or repair its underlying conflict protocol; it cannot treat a successful update as proof of exclusivity. The aggregate/read discrepancy deserves separate investigation, possibly in scan/aggregation visibility. Inspect optimistic RC workspace replacement, TN prepare/commit conflict and dedup, and aggregate pushdown after restart. This issue is related to #29400 but not necessarily a merge dependency if #29400 rejects optimistic RC lifecycle operations before effects.
Raw local QA artifacts: /private/tmp/mo29400-base-opt-rc/result.json (SHA256 4546ea4ad14b5f4ced2c2c9dfd61ce01e4c189f55a39df0c1bb8808f3d643b42) and /private/tmp/mo29400-base-opt-rc/post-restart.out (SHA256 a719d4e3ed161b92d889de0828c2e4aa1ab73507820ed86bf508726c4d6d9211). The isolated test database was dropped, its catalog absence checked, and the owned service stopped cleanly.
Activity
XuPeng-SH commentedon Sep 28, 2026
Triage decision: defer.
Optimistic transaction mode has been retired. The verified duplicate-primary-key reproduction is confined to that test-only mode; there is no confirmed reproduction in a supported pessimistic mode. This does not block #29400's pessimistic RC fix. The aggregate versus row-scan discrepancy is an observation from the same affected state, not evidence of a separate supported-mode defect.
Reassess if the failure is reproduced in a supported mode or optimistic mode is explicitly restored to the support contract.
XuPeng-SH commentedon Sep 28, 2026
Disposition update: closing as not planned because optimistic transaction mode is retired and outside the supported product contract. The duplicate-row reproduction remains documented here as evidence about that test-only mode; no fix is planned in supported production paths based on this reproduction alone. Reopen if the same defect is reproduced in a supported transaction mode or maintainers restore optimistic-mode support.
fix(disttae): preserve optimistic RC write dependencies across snapsh…