Skip to content

[BugFix] Relax DB lock to intensive path in qe/ read-only paths (backport #73067)#73190

Merged
wanpengfei-git merged 1 commit into
branch-4.1from
mergify/bp/branch-4.1/pr-73067
May 13, 2026
Merged

[BugFix] Relax DB lock to intensive path in qe/ read-only paths (backport #73067)#73190
wanpengfei-git merged 1 commit into
branch-4.1from
mergify/bp/branch-4.1/pr-73067

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented May 13, 2026

Switch four single-table read paths in qe/ from full DB READ to IS+table-READ via lockTableWithIntensiveDbLock so they no longer block concurrent DDL on other tables in the same database.

  • ShowExecutor.showCreateInternalCatalogTable: move lookup outside the lock; revalidate the resolved Table reference once the intensive lock is held so concurrent DROP/RENAME between lookup and lock acquisition is reported as ERR_BAD_TABLE_ERROR rather than serving DDL from a stale Table.
  • ShowExecutor.visitShowTabletStatement (both branches): use the known/resolved tableId for table-READ; the table-by-name branch also revalidates after locking. The single-tablet branch already re-fetches under the lock and needs no extra check.
  • ConnectProcessor.handleFieldList: move lookup outside the lock; collapse the nested lock-try inside the connector-exception try into a single try-catch-finally; revalidate after locking for internal-catalog DBs (external catalog tables are not tracked by LocalMetastore).

The revalidation closes a TOCTOU window: under the old DB READ, DROP/RENAME could not interleave between lookup and use; under IS+table-READ the lookup is unprotected so the resolved Table can be removed from the DB before the lock is taken. Re-fetching by id after locking and comparing references catches that window and reports the table as not-found, matching the old semantics.

Why I'm doing:

What I'm doing:

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 pr needs auto generate documentation
  • 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.1
    • 4.0
    • 3.5
    • 3.4

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

Signed-off-by: Kevin Cai <kevin.cai@celerdata.com>
(cherry picked from commit c15972b)
@wanpengfei-git wanpengfei-git merged commit d351ac3 into branch-4.1 May 13, 2026
46 of 47 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-4.1/pr-73067 branch May 13, 2026 06:23
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