Skip to content

fix(dml): preserve ordered ODKU semantics - #28265

Merged
XuPeng-SH merged 21 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-odku-semantics
Sep 6, 2026
Merged

XuPeng-SH merged 21 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-odku-semantics

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Preserve the SQL order of ODKU assignments, including repeated assignments to the same target column. Each RHS observes the row image produced by the preceding assignment.
  • Model a collapsed duplicate-key group as an ordered stream of logical actions. Carry a logical affected-row weight separately from the final physical-change marker, so repeated input keys and CLIENT_FOUND_ROWS are correct without forcing no-op storage/index rewrites.
  • Recompute generated columns from the final ordered row image without re-evaluating volatile assignment expressions.
  • Apply the physical-change marker to base, regular-index, IVF/fulltext, partition, direct-write, and S3-write paths. Malformed metadata fails closed; no-op irregular-index maintenance is skipped.
  • Reuse bounded stable vectors while replaying duplicate groups and derive repeated-target materialization once during Prepare.
  • Make ALTER TABLE ... DROP INDEX use the parent-owned child-relation deletion path already used by standalone DROP INDEX, removing the nested DDL lock-order inversion. Also remove the duplicate CDC task drop.
  • Add MORPC v50/v51 serialization and sender/receiver compatibility fences so an older CN cannot silently execute the new semantics incorrectly during a rolling upgrade.

Root cause

The planner reduced ODKU assignments into a map, which discarded statement order and duplicate targets. The executor then collapsed equal input keys before affected-row accounting, while a planner-level no-op filter removed the information needed for CLIENT_FOUND_ROWS. Separately, ALTER DROP INDEX invoked nested DROP TABLE after acquiring parent/index locks, reversing the lock order used by concurrent index DML.

The fix keeps three concepts independent:

  1. the ordered logical assignment/action stream;
  2. the accumulated client-visible affected-row count;
  3. the final row image that actually requires storage and index maintenance.

Validation

  • go test ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/multi_update ./pkg/sql/plan ./pkg/sql/compile
  • go test -race ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/multi_update -run 'ODKU|UpsertAffectRows|FilterODKU|PartitionContexts' -count=1
  • make err-check
  • make build
  • Real server / MySQL protocol checks:
    • dependent assignments: (a,b)=(10,20) + a=a+1,b=a => (11,11);
    • repeated target: a=a+1,a=a+1 => 12;
    • three updates to one existing key => ROW_COUNT()=6, final value 13;
    • first insert plus two same-key updates => ROW_COUNT()=5, final value 13;
    • change then restore => ROW_COUNT()=4, final value 10;
    • pure no-op => ROW_COUNT()=0; with a real clientFoundRows=true connection => 1;
    • change then restore with ON UPDATE timestamp preserves the implicit timestamp change, while a pure no-op leaves it unchanged;
    • generated-column + CHECK failure rolls back the preceding insert; base count and forced-index count both remain 1;
    • forced IVF-index lookup remains consistent after restored/no-op groups;
    • 10 rounds of two concurrent ODKU writers racing ALTER DROP INDEX: every ALTER completed; a retry confirmed the index absent in 0-2ms (no persistent wait).

Performance, same machine, five-run median (main -> this change):

workload main fixed
10K no-conflict ODKU inserts 161ms 158ms
10K distinct-key updates 179ms 181ms
10K updates over 100 hot keys 133ms 135ms
10K indexed pure no-ops 163ms 158ms

The differences are within run-to-run noise; no material regression was observed. Ordinary INSERT/UPDATE plans do not carry the two ODKU metadata columns.

make static-check-analysis completed its repository go vet/molint phase, but the local prebuilt golangci-lint executable could not start because it embeds a stale absolute macOS libmo.dylib path. No code diagnostic was emitted before that tool-environment failure.

Fixes #28177
Fixes #28178
Fixes #28180
Fixes #28181

Follow-up review and CI fixes

Review and failed-CI analysis at 55fcfdc3c6 closed four additional paths:

  • Preserve the owned stable-vector pools when probe/finalize join batches have different widths. The old replacement lost varchar/vector allocations in ordinary mixed existing-key plus repeated-new-key ODKU statements.
  • Restore the stored row image before CHECK/FK/index/RETURNING consumers when every explicit ordered action is a no-op. This keeps implicit ON UPDATE and generated values from rejecting or mutating a row that will not be written; mixed no-op plus insert and genuine CHECK failure are covered.
  • Do not create the physical-changed derivative when there are no affected irregular indexes. Every tested fulltext/vector maintenance shape now asserts that each SINK step has a consumer.
  • Release producer scopes when the compiler rejects a receiver-less SINK. The CI sequence was: orphan SINK -> compile error -> scope reuse-finalizer panic -> CN restart -> connection-refused/truncate-timeout cascade. A bad plan now remains a bounded statement error instead of crashing the CN.
  • Refresh legacy ordered-assignment and EXPLAIN expectations to match the corrected semantics and plan shape.

Follow-up validation:

  • affected-package UT: dedupjoin, multi_update, plan, compile;
  • focused race tests for ODKU vector ownership and receiver-less SINK cleanup;
  • make err-check;
  • git diff --check.

Found-rows BVT baseline follow-up (c741845de2)

The failed PROXY and pessimistic BVT jobs exposed stale expected ROW_COUNT() values, not a storage-semantics regression. mo-tester negotiates CLIENT_FOUND_ROWS: a duplicate that is a physical no-op contributes 1 logical affected row, and a mixed no-op duplicate plus one insert contributes 2. The BVT baselines and comments now reflect that client capability while retaining assertions that the row image, indexes, and implicit ON UPDATE timestamp do not change. The Coverage failure was downstream of the failed BVT coverage producers.

Validation: exact failing statements were reconciled against both CI logs; git diff --check passes. A fresh CI run is in progress on this commit.### Resolved-target lock and distributed S3 count closure (0576e740fbb)

A final topology and concurrency review closed two P1 paths:

  • A secondary-UNIQUE ODKU now locks the arbiter's resolved base-row identity, including hidden-PK tables, instead of the unrelated incoming PK. Existing non-arbitrated PK behavior is preserved, and the lock type comes from the actual pipeline column.
  • ODKU WriteS3 writers no longer publish client-visible counts through counters hidden below merge PreScopes. Each writer transfers one in-band count record to the final UpdateFlushS3Info owner. Direct, remote, multi-writer, partitioned, and all-physical-no-op paths share the same exact-once ownership rule; reset/error paths discard pending attempt state.

Performance scope: ordinary INSERT/UPDATE and legacy affected-row protocols are unchanged. ODKU adds no per-row work beyond its existing weight accumulation and emits at most one five-column, payload-free control row per writer, with no extra S3 I/O.

Validation on the exact head:

  • mo-cgo-test -count=1 ./pkg/sql/colexec/multi_update — PASS
  • mo-cgo-test -count=1 ./pkg/sql/plan — PASS
  • mo-cgo-test -count=1 ./pkg/sql/compile — PASS
  • focused resolved-lock, multi-writer, all-no-op, and reset/reuse tests — PASS
  • make err-check and git diff --check — PASS
  • added a deterministic pessimistic BVT for resolved-target lock contention; it is committed for CI execution and was not claimed as a local run.

Constraint-sensitive ODKU and deterministic DDL closure (e2caaa39da)

The latest review blockers are closed systemically:

  • ODKU action emission now intersects assigned columns (including the transitive generated-column closure) with CHECK/FK dependencies. Unrelated constraints keep the one-final-row-per-key fast path instead of emitting one row and parent probe per duplicate action.
  • Compact execution still carries constraint eligibility: new insert groups validate CHECK/FK exactly once, while existing rows with unchanged tuples bypass historical constraints. Affected CHECK/FK/NOT NULL constraints continue to validate every ordered action before final filtering.
  • Malformed CHECK/FK metadata fails with a typed planner error rather than a nil dereference.
  • ALTER DROP INDEX has a deterministic fake-engine barrier test proving direct child deletion, absence of recursive SQL DDL before deletion, failure propagation, and no catalog continuation after an injected delete failure.
  • Test CHECK builders now resolve requested columns explicitly instead of silently falling back to column 0 when Name2ColIndex is absent.

Additional test plan / evidence:

  • full UT: pkg/sql/plan, pkg/sql/colexec/dedupjoin, pkg/sql/compile — PASS
  • focused race: compact/action ODKU replay and ALTER child-delete barrier — PASS
  • hot group oracle: 8,193 constraint-independent duplicate actions produce one final row; affected constraints retain all action rows
  • counterexamples: unrelated vs affected CHECK/FK, generated dependency closure, composite FK, disabled FK checks, existing historical row, new insert followed by same-statement duplicates, malformed column/FK metadata
  • scoped golangci with verified MatrixOne CGo headers/libraries — 0 issues
  • git diff --check — PASS

Self-referencing FKs intentionally remain statement-level, as documented in the design; this change does not claim row-scoped self-FK validation.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@LeftHandCold LeftHandCold left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 29a0f02 against main/845fff8ee9cac962c5002a1007e0b0180efd591b, including the four linked issues, ordered assignment/action replay, logical versus physical row accounting, regular/irregular indexes, partition/direct/S3 writers, vector ownership, DDL cleanup and protocol propagation. Two concrete paths remain: scratch-vector ownership is lost when replay changes batch width, and moving no-op filtering downstream lets CHECK constraints reject a row image that must never be written. Details and minimal triggering inputs are inline.

Validation scope: these findings are established by tracing the production paths; the SQL snippets below are proposed regression cases, not claimed local server executions. The focused local dedupjoin test command stopped at the CGo prerequisite check (no matching libmo.dylib; primary-worktree native inputs differ), so I did not start a full rebuild or parallel UTs. Generated protobuf descriptor deltas were decoded and verified to contain exactly the declared new fields; diff --check passed. Existing author evidence and current CI were inspected; shared build/SCA/coverage are successful, with other UT/BVT jobs still pending at review time.

Comment thread pkg/sql/colexec/dedupjoin/join.go Resolved
@daviszhen

Copy link
Copy Markdown
Contributor

Revalidated the latest head c741845de24a549b2642cd900bcf10ac0a4d9e4a against both outstanding inline findings. The fixes from 55fcfdc3c666ca3b249dc6810d14361271f62855 are present: the stable per-column vector pools are preserved across join-batch width changes, and pure ODKU no-ops restore the stored row image before downstream CHECK/FK/index/RETURNING consumers. Exact-head validation passed: go test ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/multi_update ./pkg/sql/plan ./pkg/sql/compile -count=1 -timeout=600s -p 1 and git diff --check. Please re-review this exact head and resolve the two threads if the fixes are accepted.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Deep review update(正式 review 状态无法由 PR 作者自己设置为 REQUEST_CHANGES;以下结论已作为 comment 记录)。

结论仍是 不能 approve/merge。之前的 stable-vector ownership 和 pure-no-op CHECK 问题已关闭,但当前 head c741845de24a549b2642cd900bcf10ac0a4d9e4a 仍有 3 个 blocker:

  1. [P1] 中间 logical action 的 CHECK/FK 失败被折叠掉。 dedupjoin/join.go 约 L1220-L1243 逐个 replay 同 key action,但只输出最终 row;bind_insert.go 约 L3061-L3117 只对最终 row 做约束检查。反例:

    insert into child values (1,999,1),(1,1,2)
    on duplicate key update pid=values(pid), x=values(x);

    MySQL 8 会在第一个 FK 违规 action 报错并回滚;当前计划只看到最终合法 row。CHECK x > 0 的先负后正也一样。该问题同时影响首个输入为 INSERT 的新 group 和已有行 group。修复必须将每个 logical action 的约束验证与最终 physical write 分离,最终行 eligibility guard 不足以解决。

  2. [P1] 非 FK 列更新错误重新验证历史 orphan FK。 bind_insert.go 约 L3099-L3117 对所有最终输出行无条件 child→parent MARK/assert。foreign_key_checks=0 写入 (1,999,10) 后恢复为 1,执行 ... (1,999,11) ON DUPLICATE KEY UPDATE x=values(x);MySQL 8 接受(ROW_COUNT=2),x=x/pid=pid 也接受,当前实现会因无 parent 报错。FK 只应在新行或该 FK tuple 在当前 logical action 中实际改变时验证,并且必须按 action 判定。

  3. [P1] odkuValuesEqual 的类型语义不完整。 join.go 约 L1028-L1059 仅特殊处理 float/float-array,其余使用 raw bytes,和普通 UPDATE 的类型化比较不一致。至少会错误处理 CHAR(4) 'a' vs 'a '、JSON 1 vs 1.0、scaled FLOAT32。MySQL 8 实测 CHAR/JSON 均为 ROW_COUNT=0 且 ON UPDATE 不变;当前实现可能错误计数、写入并触发 ON UPDATE。需要抽取/复用完整类型化 comparator,并覆盖 CHAR、JSON、scaled FLOAT32、NULL/NaN 回归。

当前 CI 和 diff --check 为绿色,但现有测试未覆盖这些反例。修复后请 rebase 最新 main,并补充多 action constraint、历史 orphan、类型比较的 BVT/UT。

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Fixed the latest ODKU planner blocker and rebased onto current main in 93a56046590.

Root cause and invariant:

  • emitODKUActionRows is enabled by CHECK, enabled non-self FK checks, or action-level NOT NULL validation.
  • FK eligibility columns, however, are produced only when foreign_key_checks enables non-self FK validation. The DEDUP-context consumer incorrectly used the broader action-stream gate and indexed an empty FK eligibility slice.
  • FK metadata is now produced, propagated, consumed, and validated under the same odkuNeedFkCheck gate; CHECK/NOT NULL action validation remains independent. The invariant is recorded in the design document.

Regression and unhappy-path coverage:

  • Planner UT covers FK-disabled + CHECK and FK-disabled + nullable expression into NOT NULL, and verifies the action stream/assertions remain present while FK metadata is absent.
  • Real standalone mo-service/mo-tester BVT covers valid ODKU, CHECK failure, NOT NULL failure, and rollback/state preservation with FK checks disabled; 345/345 commands passed twice on the same instance.
  • DEDUP metadata contract tests now cover list mismatch, result/source bounds, source types, shared metadata slots, action/FK marker types, empty/out-of-range FK columns, and ODKU comparison-column bounds. DedupJoin.Prepare statement coverage is 97.5%.

Validation on the rebased exact head:

  • core packages: dedupjoin, preinsertunique, multi_update, plan, compile — PASS (-p 1)
  • focused planner and malformed-plan tests — PASS
  • go vet for touched packages, make err-check, and git diff --check — PASS
  • make build and the standalone BVT above — PASS

No CI result is claimed yet; this update does not wait for CI.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of exact head 93a56046590b0239bdb7579e266f77184989c11a against main/cd096e20f04a51ad2975a868f013df83423e0c2a.

The earlier correctness blockers are closed: ordered/repeated assignment replay, per-action CHECK/FK/NOT NULL validation, historical-orphan FK eligibility, typed no-op equality, statement-local target arbitration, resolved-target locking, and distributed/S3 affected-row ownership all have coherent producer/consumer contracts on this head. I did not find another concrete correctness, leak, unbounded-retention, or wait-cycle bug in those paths.

I still cannot recommend merge because two acceptance blockers remain:

  1. [P1 performance] Preserve the documented fast path when updated columns cannot affect a constraint.

    bind_insert.go:2422-2423 enables EmitActionRows for any CHECK or enabled non-self FK on the table. It does not use possiblyChangedCols to determine whether the ODKU assignment (including generated dependents) can change that constraint. The existing planner test at bind_upsert_affect_rows_test.go:210-221 even locks in the slow path for sal = sal although the FK tuple is unchanged.

    This is not just metadata overhead. appendModernChildFkMarkOks builds/probes a parent MARK join for every emitted action before the eligibility guard is evaluated. Therefore a hot-key input with N duplicates and a wide payload, updating only a column unrelated to CHECK(pid > 0) / FOREIGN KEY(pid), expands from one final row per key to N wide action rows plus N FK probes. Replay batches bound peak memory, but they do not remove the multiplicative CPU/copy cost. It also contradicts the design contract at lines 138-140: “Tables whose ODKU targets cannot affect an action-level constraint retain the one-row-per-key-group fast path.” The four reported benchmarks do not include CHECK/FK/NOT NULL or a wide row, although the design requires both.

    Please make action emission constraint-sensitive: intersect updated/generated-dependent columns with each CHECK/FK dependency (NOT NULL is already assignment-sensitive), retain final validation where sufficient, and emit ordered actions only for constraints that can vary between actions. Add plan coverage for an unrelated-column update on CHECK/FK tables and report the constrained hot-key + wide-row evidence required by the design. If dependency pruning is intentionally deferred, the design/body and performance claim must be corrected and the worst-case cost quantified before acceptance.

  2. [P1 regression coverage] Commit a deterministic test for the ALTER DROP INDEX lock-order fix.

    The production change replaces nested DROP TABLE with dropIndexChildRelation, but this PR changes no DDL test. TestDropIndexChildRelationCleansLegacyPrivileges predates this branch and tests only the helper's privilege cleanup; it never exercises alterTableInplace, proves nested SQL is absent, or controls the DML/DDL lock ordering. Consequently reverting the critical call at ddl.go:872 to runSqlWithOptions("DROP TABLE ...") would leave all committed tests green. The manual ten-round race is probabilistic, while the design validation matrix explicitly claims a “deterministic barrier/fake-engine test” and says sleeps/probabilistic retries are not correctness oracles.

    Please add a deterministic regression that enters the ALTER DROP INDEX path with a fake engine/barrier, asserts parent-owned direct child deletion (and no recursive DDL acquisition), covers the error/rollback path, and demonstrates termination under the former conflicting lock order. Otherwise remove the unsupported validation claim, but for a hang/deadlock fix I consider the deterministic regression part of acceptance.

Non-blocking documentation point: the design says self-referencing FKs retain the existing post-execution statement-level path, whereas the PR body describes per-action FK validation without that exception. Record this limitation in the body so the supported semantic boundary is not overstated.

Validation boundary: git diff --check passes and the worktree is clean. I inspected current CI but did not wait for it. Local Go tests could not start in the isolated exact-head worktree because it has no matching cgo/libmo.dylib; the repository wrapper correctly rejected reusing the primary worktree's mismatched native artifact, so no local test pass is claimed here. Shared Build is successful; exact-head UT/SCA/coverage/BVT jobs were still running at review time.

GitHub does not allow a PR author to submit REQUEST_CHANGES on their own PR, so this is recorded as a COMMENTED review with a request-changes conclusion.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of exact head e2caaa39da8080bfb74eb6d12b67dd7e954378f2 against base cd096e20f04a51ad2975a868f013df83423e0c2a.

Verdict: request changes. GitHub does not allow the PR author to submit REQUEST_CHANGES on their own PR, so this is recorded as a formal COMMENTED review with the equivalent blocking conclusion.

Historical findings

The earlier concrete findings are closed on this head:

  • scratch-vector ownership across probe/finalize schema-width changes: the per-column stable pools are extended rather than replaced and are released by Reset/Free;
  • pure ODKU no-op row-image restoration before CHECK/FK/index/RETURNING consumers;
  • per-logical-action CHECK/FK/NOT NULL validation, typed no-op equality, and historical-existing orphan FK eligibility;
  • statement-local target arbitration, constant-NULL target handling, resolved-target positioning/locking, and composite hidden-key identity domains;
  • FK-disabled + CHECK/NOT NULL planning panic: FK eligibility production and consumption now use the same FK-enabled gate;
  • the previous performance finding is addressed for isolated unrelated CHECK/FK updates: those plans retain compact one-row-per-key execution;
  • the ALTER DROP INDEX lock-order change now has a deterministic fake-engine barrier/error-path regression and uses parent-owned direct child deletion;
  • the PR body now states the self-referencing-FK boundary.

New blocker

[P1 correctness] A statement-local INSERT followed by UPDATE actions can bypass every unaffected CHECK/FK when another constraint enables action-row replay.

The new final-only CHECK marker is implemented as an ODKUForeignKeyCheck over the immutable primary key (bind_insert.go:3070-3085). For a new duplicate group, finalizeODKUActionRows emits the first INSERT action with all eligibility bits true but ActionFinal=false (dedupjoin/join.go:674-676). Each later action receives foreignKeyChanges(...); the synthetic PK does not change, so its bit is false (join.go:696-712). The planner then filters on ActionFinal before evaluating final-only CHECKs (bind_insert.go:3137-3146). Thus the only row carrying insert eligibility is discarded, while the retained final row is guarded out.

The same provenance loss affects an unrelated FK. The first INSERT action is not checked by odkuActionConstraintDef because that FK is unrelated to the UPDATE; the later final-image FK assertion sees a false tuple-change bit and skips it. This violates the required distinction between “an existing historical row whose tuple was unchanged” and “a row newly inserted by this statement whose tuple was unchanged by subsequent actions.”

Minimal CHECK counterexample:

create table t (
  id int primary key,
  pid int,
  x int,
  check (pid > 0),
  check (x >= 0)
);
insert into t values (1, -1, 0), (1, 10, 1)
on duplicate key update x = values(x);

The first row creates a new group with invalid pid; the second row conflicts and updates only x, which enables action replay through the affected check (x >= 0). The final row still has pid=-1 and must fail check (pid > 0), but the current eligibility flow skips it.

Equivalent FK counterexample:

create table p (id int primary key);
create table c (
  id int primary key,
  pid int,
  x int,
  check (x >= 0),
  foreign key (pid) references p(id)
);
insert into c values (1, 999, 0), (1, 1, 1)
on duplicate key update x = values(x);

The newly inserted group retains pid=999, so the statement must fail; current action-row provenance can guard the final FK check out.

The existing executor matrix misses this exact cross-product: its new-group action-row cases track an updated payload, while the new-group unchanged-key case uses compact execution. Please model group-origin INSERT eligibility separately from per-action tuple-change eligibility, then add regression coverage for new/existing × compact/action-row × single/multiple actions, with unaffected CHECK and FK, real/fake PK, and resumed batching. A fix must retain the fast path for unrelated constraints without skipping validation of newly inserted rows.

Other review dimensions

I re-audited the retained-vector ownership, resumable probe/finalize state, mailbox termination, S3 affected-row ownership transfer, v50/v51 serialization fences, optimizer ref/remap/deep-copy propagation, and direct DDL deletion/error paths. I found no additional concrete blocker in those paths. The branch is currently behind main; exact-head shared build, Ubuntu/x86 UT, SCA, coverage, and pessimistic BVT are green, while proxy BVT was still running at review time. I did not wait for CI or repeat previously completed 55-machine validation.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Fixed the final-insert constraint eligibility blocker in 2e7d9adb54.

Root cause: action replay carried only per-action tuple changes. For a group created by this statement, an unchanged unrelated CHECK/FK was eligible on the initial INSERT action, but that row was removed by the final-action filter; the final row then carried false, so final-only validation was skipped.

The executor now keeps the two facts independent: intermediate actions use tuple-change eligibility, while the final row of a statement-created group retains insert-origin eligibility for every final-image constraint. This is applied consistently to the resumable and legacy finalize paths.

Evidence:

  • Pre-fix focused UT reproduced [true,false] for a two-row new group whose final action changed an unrelated column.
  • Post-fix full pkg/sql/colexec/dedupjoin UT passes.
  • Added continuous and 8,193-row/cross-batch action-replay regressions.
  • On 10.222.1.55, exact head 2e7d9adb54, clean rebuilt mo-service: unrelated CHECK and FK counterexamples both failed with the expected errors and left zero rows; nearby valid controls produced (2,1,1). The complete SQL sequence passed twice on the same instance.
  • Test-owned service and data were removed after validation; no mo-service remains.

CI was restarted by the push and is intentionally not being waited on.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of exact head 98cbfbc91ccc88f55ae015e618cbf4ce366abc27 against merge base c1293102fd18908b59c4b049140aad67a50e0b16.

Verdict: no remaining code blocker found. This is my own PR, so GitHub cannot record an APPROVE review; this COMMENTED review is the author-side no-blocker conclusion and requests independent approval.

The last blocker from e2caaa39da is closed by 2e7d9adb54:

  • finalizeInsertConstraintEligibility is reached only while finalizing unmatched groups, i.e. groups created by this statement. Both the resumable and legacy finalize implementations now make the final image eligible for every final-image constraint.
  • Intermediate actions still use tuple-change eligibility, so affected CHECK/FK/NOT NULL failures occur before the ActionFinal filter and cannot be folded away.
  • Existing-row probe/replay paths were not broadened: they retain tuple-change eligibility, so an unrelated update still does not revalidate a historical orphan FK.
  • Single-action/compact groups preserve their original insert eligibility; multi-action and DefaultBatchSize+1 replay preserve first-action plus final-image eligibility. Real/fake/composite PK identity remains immutable for this marker.
  • The public CHECK and FK counterexamples now fail and roll back to zero rows; nearby controls prove that unapplied incoming columns do not create false violations.

Historical review map was reused and rechecked for interaction: ordered/repeated assignment replay, typed no-op equality, constraint-sensitive fast path, target arbitration/locking, stable vector ownership, bounded replay/arbitration state, WriteS3 affected-row transfer, protobuf fences, direct ALTER DROP INDEX ownership, and self-FK scope remain closed. The current design is consistent with the implementation and explicitly states the fast path, ownership, bounds, self-FK limitation, and deterministic validation contracts.

Unhappy-path closure for the new delta:

Q Result
Q1 cleanup ownership PASS — no new resource owner; result rows and stable vectors retain the existing Reset/Free owner.
Q2 wait termination PASS — no new wait/lock/channel/RPC edge; errors return through the existing operator cleanup path.
Q3 accumulation bound PASS — the reused eligibility slice is bounded by constraint count, and action output remains bounded by batch/soft-byte limits.

Evidence reused by semantic validity:

  • exact business head 2e7d9adb54: focused UT plus clean 10.222.1.55 build and CHECK/FK black-box counterexamples, including cross-batch action replay and same-instance repetition;
  • exact merge head 98cbfbc91c: shared build, Ubuntu UT, SCA, coverage, proxy BVT, and pessimistic BVT all completed successfully;
  • git diff --check passes and the review worktree is clean.

The branch is one commit behind current main@2da034110c; that commit is test-only publication/subscription coverage and does not intersect this PR. Rebase is still needed for delivery policy, but it does not invalidate the review conclusion. The remaining GitHub CHANGES_REQUESTED state is from an outdated thread that this series has addressed.

This branch was previously deployed

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

Labels

size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

4 participants