Skip to content

to 3.0: fix(sql/plan): prebuild composite-unique lock column mapping for INSERT#23763

Merged
mergify[bot] merged 5 commits intomatrixorigin:3.0-devfrom
gouhongshen:codex/fix-23759-prebuild-unique-lock-col
Feb 25, 2026
Merged

to 3.0: fix(sql/plan): prebuild composite-unique lock column mapping for INSERT#23763
mergify[bot] merged 5 commits intomatrixorigin:3.0-devfrom
gouhongshen:codex/fix-23759-prebuild-unique-lock-col

Conversation

@gouhongshen
Copy link
Contributor

@gouhongshen gouhongshen commented Feb 25, 2026

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue ##23759

What this PR does / why we need it:

This PR fixes a lock-target mapping issue for INSERT on tables with composite unique keys (e.g. UNIQUE KEY (a, b)), which could lead to missed conflict detection on CN.

Problem:

During lock target construction, colName2Idx could miss __mo_index_idx_col for composite unique indexes.
The previous logic then effectively used an incorrect column index path, so CN might lock the wrong column instead of the composite unique key value.
Root cause:

__mo_index_idx_col mapping for composite unique keys was not guaranteed to be materialized before lock target generation.
Fix:

Pre-materialize the composite unique lock key (serial(...)) before lock target construction.
Populate colName2Idx for indexTable.__mo_index_idx_col in advance.
Add explicit map-hit checks when reading lock target column indexes, returning an internal error if missing (instead of silently proceeding).
Why this is better:

Moves lock-key readiness earlier in the pipeline, so lock target building reads a complete mapping.
Avoids implicit/default index behavior.
Keeps lock behavior deterministic for composite unique keys.

@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Feb 25, 2026
@mergify mergify bot added the queued label Feb 25, 2026
@mergify mergify bot merged commit f99223f into matrixorigin:3.0-dev Feb 25, 2026
23 of 24 checks passed
@mergify
Copy link
Contributor

mergify bot commented Feb 25, 2026

Merge Queue Status

Rule: release-3.0


  • Entered queue2026-02-25 13:51 UTC
  • Checks passed · in-place
  • Merged2026-02-25 13:52 UTC · at 3947a1511df1683ce063dfcaf85168639532dcf2

This pull request spent 9 seconds in the queue, with no time running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI (3.0) / Coverage
    • check-neutral = Matrixone Utils CI (3.0) / Coverage
    • check-skipped = Matrixone Utils CI (3.0) / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)

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

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants