Skip to content

fix: filter CHECK violations in LOAD DATA IGNORE - #30355

Merged
mergify[bot] merged 8 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/1389e273965c29ee15555b29cd6b81411634abebcf62b4a71b62c701aff85442
Oct 18, 2026
Merged

mergify[bot] merged 8 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/1389e273965c29ee15555b29cd6b81411634abebcf62b4a71b62c701aff85442

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

What this PR does / why we need it:

LOAD DATA ... IGNORE currently warns about a violated CHECK but persists the row because its duplicate-key FAIL policy selects a CHECK assertion rather than a row filter.

Pass LOAD's explicit CHECK-ignore policy separately into the shared insert planner. Filter the final assigned/generated row image before deduplication and table/index maintenance, materializing composite unique-lock keys before the filter. Keep the existing LOAD duplicate-key and foreign-key policies and ordinary LOAD's atomic CHECK failure.

Regression coverage uses real LOCAL and server INFILE over the MySQL protocol, immediate warning checks, and exact committed rows from a second CN. It covers multiple and stored-generated CHECKs, NULLs, single/composite unique-key reuse, invalid/valid candidates sharing keys within one load, and ordinary LOAD / INSERT IGNORE / duplicate / foreign-key controls. Planner tests also verify the CHECK barrier precedes fulltext maintenance.

Validation on Go 1.27.1, macOS arm64:

  • Full pkg/sql/plan package passed (28.211s), including existing INSERT IGNORE/ODKU and the new CHECK/fanout regressions.
  • Six CHECK regression subcases passed through the public MySQL protocol on the shared two-CN fixture. The independent baseline run emitted 3819 but exposed the invalid row from the other CN.
  • The updated duplicate/FK policy control passed in a selected run (5.859s including the two-CN fixture).
  • Changed-package go vet and golangci-lint passed. The issues-package lint was rerun after the final test-only edit: 0 issues.

CI remains pending. CHECKs are evaluated once per candidate, and rejected rows avoid downstream write work.

@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 →

Replace the regression oracle that required the known LOAD duplicate-key
bug with explicit planner policy checks and an exact INSERT IGNORE control.
Keep LOAD foreign-key rejection in an independent subtest.

Validated both owning packages, the full CHECK regression with coverage and
matrixone_test tags, go vet, and incremental lint.
@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · superseded

Commit: 1115339943c4b225c5515088866b6793654cc331

Review belongs to an older commit; it is not a review of the current head.

Wait for the reader CN logtail to pass the writer commit before opening
the assertion query snapshot. Cross-CN autocommit reads otherwise race
with logtail application and can miss valid committed rows. Keep every
exact warning, rollback, key-reuse, and committed-row assertion.

The original missing-row failure reproduced under coverage repetition.
The repaired regression passes 20 coverage rounds, focused race validation,
go vet, and incremental lint.
Ordinary LOAD now validates declared primary keys after main PR matrixorigin#30421.
Update the CHECK-policy test to require one FAIL dedup on the primary key
for ordinary LOAD, while retaining the bypass for LOAD IGNORE and the
positive INSERT IGNORE arbitration control. Preserve all CHECK placement,
barrier and exactly-once assertions across the ten existing cases.

Validation: focused matrixone_test coverage cases, complete planner package
with vet=all, incremental lint, formatting and diff checks passed.
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-18 03:50 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in-place
  • 🚫 Left the queue — 2026-10-18 06:02 UTC · at 6232aae78763cbbbcddef4b1a6d9cddd2bebfc59

This pull request spent 2 hours 12 minutes 40 seconds in the queue, with no time running CI.

Reason

The merge conditions cannot be satisfied due to failing checks

  • CI Required

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Requeued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-18 07:22 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-18 07:22 UTC · at 35253f2a95e88ec6537696015b6189442aff23d1 · squash

This pull request spent 17 seconds in the queue, including 1 second running CI.

Required conditions to merge

Copy link
Copy Markdown
Contributor

Post-merge functional validation on main 4226537e5094995155eab9c2a883db649ff7b95b (Linux/amd64, Go 1.27.1, matching CPU/CGo, real authenticated two-CN MySQL TCP): TestIssue30345LoadIgnoreCheckConstraints passed its root and all 20 named subcases, including LOCAL/server-side, generated CHECK/composite UNIQUE, fulltext, invalid-row index exclusion, subsequent valid-key insertion and peer visibility.

The separate FK compatibility observation in #30345's comments remains intentionally unchanged: load_ignore_keeps_foreign_key_rejection confirms statement rejection/zero writes rather than warning-and-skip. This is not attributed as a regression from this PR. I retained development ownership instead of transferring the entire issue's combined scope to QA. Evidence and exact command: #30345 (comment) . 4.2 CHECK behavior and original external deployment were not qualified.

This branch was previously deployed

1 inactive deployment
ci — 6232aae7 Deployed Oct 18, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued 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