Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Oct 13, 2025

Why I'm doing:

Schema inference for files() (filesystem listing + backend RPC) previously executed while holding DB/table metadata locks during analysis, amplifying lock contention and planning latency under slow or remote storage.

What I'm doing:

  • acquire the target table read lock only when pushDownSchemaFunc runs
  • reload the session-aware target table under lock to copy its latest schema
  • keep files() initialization and other analyzer logic outside the metadata lock

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.0
    • 3.5
    • 3.4
    • 3.3

Note

Moves schema pushdown locking into a short-lived table READ lock and simplifies Insert analysis flow outside locks.

  • Analyzer (InsertAnalyzer):
    • Simplifies analyzeWithDeferredLock: performs properties analysis, files() schema pushdown, and query analysis without holding planner/meta locks; removes conditional lock-taking logic.
    • Updates files() schema pushdown to lock only the target table during schema copy:
      • Resolves Database and target table ID; within pushDownSchemaFunc acquires Locker READ lock on the table, reloads session-aware table, applies column mapping, then unlocks.
    • Keeps Hive connector metadata cache toggle based on source tables.
  • Locking:
    • Introduces Locker/LockType usage to replace broader planner/meta lock during files() schema inference.

Written by Cursor Bugbot for commit d102414. This will update automatically on new commits. Configure here.


This is an automatic backport of pull request #63796 done by [Mergify](https://mergify.com).

Copy link
Contributor Author

mergify bot commented Oct 13, 2025

🧪 CI Insights

Here's what we observed from your CI run for 4064ea5.

🟢 All jobs passed!

But CI Insights is watching 👀

@wanpengfei-git wanpengfei-git merged commit 63d258d into branch-4.0 Oct 13, 2025
55 of 58 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-4.0/pr-63796 branch October 13, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants