Skip to content

fix: restore load data pre-lock path - #24226

Merged
mergify[bot] merged 1 commit into
matrixorigin:3.0-devfrom
LeftHandCold:fix/load-data-table-lock-regression
Apr 27, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:3.0-devfrom
LeftHandCold:fix/load-data-table-lock-regression

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #24213

What this PR does / why we need it:

PR #24201 moved Query_INSERT table locking off the pre-pipeline path. LOAD DATA is also planned as Query_INSERT and always carries a table-locking LockOp, so TPCH 1T load started taking that path too and the nightly load phase regressed noticeably after b79773d.

This patch keeps the #24201 behavior for regular INSERT statements, but restores the pre-pipeline table lock for LOAD DATA only. That keeps the fix scope narrow and avoids changing unrelated INSERT paths again.

A compile test was added to lock the routing behavior between regular INSERT and LOAD DATA.

Copilot AI review requested due to automatic review settings April 27, 2026 08:42
@LeftHandCold
LeftHandCold requested a review from a user April 27, 2026 08:42
@matrix-meow matrix-meow added the size/XXL Denotes a PR that changes 2000+ lines label Apr 27, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Apr 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Restores pre-pipeline table locking for LOAD DATA (while keeping the narrowed lock window behavior for regular INSERT) and adds/updates several SQL planner/parser features and related tests.

Changes:

  • Restore pre-pipeline table locking for LOAD DATA planned as Query_INSERT with LoadTag, and add a compile test to lock in the routing behavior.
  • Add MySQL operators/features: NULL-safe equality (<=>) and JSON -> / ->> operators, plus JSON→numeric casting support and comparison fallback improvements.
  • Add multi-table DROP TABLE planning/execution support (including privilege checks), protobuf updates, and distributed SQL test cases.

Reviewed changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/distributed/cases/join/apply.result Updates expected output now that JSON→BIGINT casting succeeds for a previous failing query.
test/distributed/cases/function/func_null_safe_equal.sql Adds distributed SQL coverage for <=> behavior across types and NULLs.
test/distributed/cases/function/func_null_safe_equal.result Expected results for <=> distributed SQL tests.
test/distributed/cases/function/func_json_arrow.sql Adds distributed SQL coverage for JSON -> / ->> operators.
test/distributed/cases/function/func_json_arrow.result Expected results for JSON arrow operator distributed SQL tests.
test/distributed/cases/ddl/drop_table_multiple.sql Adds distributed SQL cases for multi-table DROP TABLE semantics and errors.
test/distributed/cases/ddl/drop_table_multiple.result Expected results for multi-table DROP TABLE distributed SQL cases.
proto/plan.proto Extends DropTable plan message to carry per-table entries for multi-drop statements.
pkg/sql/plan/function/list_operator.go Registers <=> as an operator with typing/casting rules.
pkg/sql/plan/function/init.go Adds encoded ID/name constants for <=>.
pkg/sql/plan/function/function_id_test.go Updates function ID registry test to include NULL_SAFE_EQUAL.
pkg/sql/plan/function/function_id.go Adds function ID and registry entry for <=>.
pkg/sql/plan/function/func_compare_test.go Adds tests for mismatch comparisons (large integers, special floats) and <=> mismatch behavior.
pkg/sql/plan/function/func_compare_fix.go Reworks numeric type-mismatch comparisons to avoid float precision loss (big.Rat-based path + approximate float path) and adds null-safe variant.
pkg/sql/plan/function/func_compare.go Implements runtime <=> evaluation; updates numeric mismatch fallback callsites to new comparator signature.
pkg/sql/plan/function/func_cast_test.go Adds tests for JSON→(u)int64 precision and overflow behavior.
pkg/sql/plan/function/func_cast.go Adds JSON→numeric cast support with stricter parsing/overflow handling.
pkg/sql/plan/deepcopy.go Adds DeepCopyDropTable and uses it for drop-table DDL deep copying (supports nested multi-drop entries).
pkg/sql/plan/build_expr_test.go Adds planner test ensuring tuple <=> binds correctly (including single-element tuple edge).
pkg/sql/plan/build_ddl_test.go Adds test for FK sentinel handling when dropping tables with targets.
pkg/sql/plan/build_ddl.go Implements multi-table DROP TABLE plan building and FK-aware allow/deny logic across multiple targets.
pkg/sql/plan/build_alter_table_test.go Adds tests ensuring JSON→numeric remains blocked for DDL type changes.
pkg/sql/plan/build_alter_modify_column.go Blocks JSON→numeric for DDL modify-column while allowing JSON→text.
pkg/sql/plan/base_binder.go Adds binding logic for <=>, including tuple comparison lowering to element-wise <=> + and.
pkg/sql/parsers/dialect/mysql/scanner.go Extends lexer to produce tokens for -> and ->> (ARROW/LONG_ARROW).
pkg/sql/parsers/dialect/mysql/mysql_sql_test.go Adds formatting/printing tests for -> / ->> rewriting to function calls.
pkg/sql/parsers/dialect/mysql/mysql_sql.y Adds grammar rules for JSON arrow operators and their precedence.
pkg/sql/compile/ddl.go Supports executing multi-table drop plans and skips no-op entries; adds warning/continue behavior for missing FK-child tables.
pkg/sql/compile/compile_test.go Adds compile unit test for pre-pipeline lock decision logic (INSERT vs LOAD DATA).
pkg/sql/compile/compile.go Restores pre-pipeline locking for LOAD DATA while keeping INSERT lock deferral behavior.
pkg/frontend/authenticate_test.go Adds extensive auth tests for multi-drop privilege/ownership fallback behavior and no-op entries.
pkg/frontend/authenticate.go Updates privilege tip extraction and privilege enforcement for multi-table DROP TABLE; updates implicit revoke logic for multi-drop.

Comment thread pkg/sql/compile/compile.go Resolved
Comment thread pkg/sql/plan/build_ddl.go Resolved
@mergify mergify Bot added the queued label Apr 27, 2026
@mergify

mergify Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-04-27 14:55 UTC · Rule: release-3.0
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-04-27 14:55 UTC · at fac0ccd4bfd2917d0b5d1775c321a891e3d26d56 · squash

This pull request spent 18 seconds in the queue, including 3 seconds 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)

@mergify
mergify Bot merged commit 687e0f8 into matrixorigin:3.0-dev Apr 27, 2026
43 of 45 checks passed
@mergify mergify Bot removed the queued label Apr 27, 2026
@LeftHandCold LeftHandCold mentioned this pull request Apr 28, 2026
1 of 7 tasks

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

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants