Skip to content

fix(load): authorize Arrow LOAD before planning - #28633

Merged
XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
iamlinjunhong:m-28618
Oct 21, 2026
Merged

XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
iamlinjunhong:m-28618

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Sep 10, 2026 •

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:

issue #28618

What this PR does / why we need it:

Authorize LOAD targets before planning can inspect an Arrow/S3 source, including PREPARE, plan rebuilds and executable EXPLAIN wrappers. Keep the existing plan-level authorization check.

Preserve the session database and the compiler database independently across temporary authorization binding. A LOAD prepared in database A must still write to A after USE B and a sql_mode change triggers replanning; the session remains in B.

Validation on macOS/arm64 with the repository CGo test wrapper:

  • Focused LOAD authorization and database-binding unit tests passed, including allow, deny, lookup-error and independent compiler/session bindings.
  • Full frontend package passed with -vet=all.
  • Full Arrow BVT and the real MinIO denied-read regression passed without skips.
  • The prepared database-binding regression uses a local Arrow file and reuses the existing BVT cluster. Initial and same-instance repeats both write A=2/B=0 after replanning and preserve DATABASE()=B. The same regression wrote A=1/B=1 before this correction. Checked teardown and the final test both passed.

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

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Sep 10, 2026
@XuPeng-SH

XuPeng-SH commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · superseded

Commit: 05279eac839e11181fbd8f143b6df078586732ad

"interrupted"

@XuPeng-SH

XuPeng-SH commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · superseded

Commit: 7bed90b4db90934f96a0274d2ad5aa7537e24345

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

@XuPeng-SH

XuPeng-SH commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 7bed90b4db90934f96a0274d2ad5aa7537e24345

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Commit: 7bed90b4db90934f96a0274d2ad5aa7537e24345

Assessment: approve

Reviewed the complete five-file delta and affected callers. Early LOAD authorization appropriately reuses the existing privilege owner. Independent database restoration fixes the prior prepared-LOAD misrouting. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • All six added frontend test functions passed.

  • Public SQL regression passed twice on one cluster: prepared LOAD retained A=2/B=0 after replanning, while DATABASE() remained B.

  • Production MySQL/S3 clients against a counted HTTP fixture confirmed zero source requests for denied direct LOAD, PREPARE, EXPLAIN variants and revoked-privilege rebuilds. Granting INSERT enabled successful loading.

  • The same authorization probe failed against exact merge-base production files: six denied paths accessed the source.

  • Isolation, native provenance, formatting and whitespace checks passed. Commands, source fingerprints, exits and retained logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/38e41d9fec2a6fc28d1e4025/attempt-1/evidence-audit.json. Source remained unchanged.

  • Frozen exact-head CI reports successful UT, coverage, SCA and BVT. Performance review found added privilege work confined to LOAD planning; other statements incur bounded type inspection.

Limitations:

  • Real MinIO was unavailable; local protocol validation used an HTTP object fixture. Full local suites and throughput benchmarks were not repeated.

  • An initial diagnostic incorrectly expected binary LOAD preparation to reach authorization; both candidate and base reject it during parsing. The corrected diagnostic passed.

  • Linked issue #28618's body and underlying author-validation receipts were absent from the supplied evidence.

@mergify mergify Bot added the queued label Oct 21, 2026
@mergify

mergify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-21 13:12 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-21 14:31 UTC · at 483e525ff848d47aa6a2997d02a1d53f35581016

This pull request spent 1 hour 19 minutes 13 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

This pull request seems to come from a fork, and Mergify needs the author's permission to update its branch.
The author needs to enable "Allow edits from maintainers" on this pull request, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch was previously deployed

1 inactive deployment
ci — 483e525f Deployed Oct 21, 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/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants