Repository navigation
fix(sql): keep temporary table aliases consistent - #30864
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
|
e96252d to
42d5c1a
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 57d460d6a5b4518d24c538e4e11c481423484056
Assessment: request_changes
Reviewed all 17 changed files and affected callers. Shared alias encoding and separating logical cleanup from physical retirement are appropriate, but missing-table recovery remains incomplete for stored procedures and hidden indexes.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
-
P2
pkg/frontend/compiler_context.go:734: Another session drops and recreates the backing database, then the owning session calls a stored procedure containing DROP TEMPORARY TABLE without IF EXISTS.
Impact: backSession does not implement MissingTemporaryTableForgetter, so planning leaves the stale upstream alias registered. CALL returns 'no such table', but subsequent CREATE TEMPORARY TABLE still reports 'table already exists'. Forward the forgetting operation through the background-session adapter to complete the intended recovery.
Evidence: Confirmed through real SQL: CALL returned error 1146 and recreation returned error 1050; direct DROP on the same connection then allowed recreation and successful DML. See public-sql-v2.log and checks/1792883229832811926-3.json. The focused background-session planner probe independently fails in background-focused.log. -
P2
pkg/frontend/temporary_ddl.go:91: Create a temporary table and an independent index, let another session drop/recreate its database, then DROP the stale root alias.
Impact: ForgetMissingTemporaryTable removes only the root. The generation-scoped child cleanup remains in RetireTemporaryTable, which the missing-root path no longer calls. Hidden aliases accumulate and eventually prevent new temporary tables at the 1,024-entry limit, despite no live roots. Reuse safe child-ownership cleanup without scheduling physical deletion.
Evidence: The production planner probe confirms that the root disappears while its generated child alias remains. The lifecycle probe reaches 1,024 retained aliases, zero live roots and zero retired entries, then fails CheckTemporaryTableCapacity. See frontend-focused.log and checks/1792883147312686485-3.json.
Validation:
-
Artifacts are retained under /home/xupeng/.local/state/mo-bot/jobs/899f56f15a79702dc7ddee8a/attempt-1. Audit matched 11 command/source/exit receipts to logs, verified native provenance and confirmed unchanged frozen source; audit receipt: checks/1792883439168305581-4.json.
-
Isolation preflight and current-revision make cgo passed. Focused frontend/compile tests passed for dotted identities, migration, rollback journals, legacy-prefix isolation, reused-name safety, direct DROP recovery and index naming.
-
Exact temp_ddl_transactions.sql/result passed normal mo-tester comparison twice on one instance: 113/113 statements each, with SQL/ISCP readiness and database teardown verified.
-
Real SQL verified dotted-name isolation and reproduced the stored-procedure defect. Planner/session probes reproduced hidden-index retention and capacity exhaustion.
-
Isolated empty-map lookup benchmark: base expression 12.13–12.21 ns, zero allocations; new encoding 68.86–75.97 ns, one 32-byte allocation. This is a measured lookup cost, not a demonstrated SQL-throughput regression.
Limitations:
-
Full owning-package and race suites were not rerun locally. Supplied CI statuses are successful, but detailed CI execution logs were not supplied.
-
Index-capacity exhaustion was demonstrated through production planner/session methods with mocked storage; stored-procedure failure was reproduced through a real SQL service.
-
The first SQL probe used invalid procedure-body syntax; that diagnostic failure was excluded and corrected in the retained v2 probe.
-
The full linked issue #30583 discussion was absent from the frozen evidence.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 4d3fc54b830b0b78c623f1e84fd4ff71601c6f63
Assessment: approve
Reviewed the complete 19-file delta and affected callers. Injective alias keys, session-owned logical cleanup, and generation-scoped child cleanup restore the intended invariants without duplicating lifecycle ownership. The five earlier review concerns are addressed; no actionable unresolved defects remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Verified frozen source, matching patch, clean checkout, diff whitespace and formatting of all 17 changed Go files.
-
Isolation preflight passed. Recovered a repository-owned native build after verifying 192 matching inputs, 62 artifacts, and its build receipt/log; rejected the stale initial candidate.
-
Focused tests passed: 109 test/subtest events, including all 10 new test entrypoints. Full defines, planner and process packages passed.
-
Five exact lifecycle tests each passed 100 race-enabled repetitions. The full compiler race suite passed. Frontend results and fixture recovery are qualified below.
-
Authenticated SQL probe passed two recovery rounds on one native instance, covering direct DROP, temporary DROP, stored procedures, independent indexes, transaction recreation, DML and dotted-name isolation.
-
Isolated lookup benchmark measured 72.60–77.61 ns and one 48-byte allocation versus 12.21–12.43 ns and zero allocations for the base expression. This bounded correctness cost adds no ordinary-resolution storage I/O or goroutines.
-
Evidence audit reconciled 16 checks with commands, source fingerprints, exit statuses and retained logs. Artifacts: /home/xupeng/.local/state/mo-bot/jobs/fdf53ce5cb97c9cdb82f7547/attempt-1/validation-audit.json and review-map.md. Audit receipt: checks/1792889335515837863-2.json.
Limitations:
-
The full frontend race command failed only because unchanged Test_openNewFile_nilCtx writes into the read-only checkout. That test passed separately with a diagnostic-only t.TempDir fixture adjustment; the original package failure remains recorded. Three unrelated existing subtests skipped.
-
The complete mo-tester suite and SQL throughput benchmarks were not run locally. Author claims and supplied CI success statuses were treated as supplemental evidence.
-
The standalone linked issue #30583 discussion was absent from the frozen evidence.
Merge Queue Status
This pull request spent 3 hours 54 minutes 58 seconds in the queue, with no time running CI. ReasonPull request #30864 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
…cbbb75fcad81bcda3f398cc39754fa7e90dc056
What type of PR is this?
Which issue(s) this PR fixes:
#30583
What this PR does / why we need it:
Temporary-table aliases were keyed by
database + "." + alias, so dotted database and alias names could collide. A temporary alias could also remain after its physical relation was removed by another session, leaving the name unusable.This change uses one length-prefixed key for all temporary-table alias maps and lifecycle paths. Confirmed missing temporary databases or relations forget the alias while preserving existing
IF EXISTSand error semantics, including DROP executed by stored procedures. This logical cleanup removes rollback history and generation-owned hidden index aliases without queuing a physical DROP that could target a replacement table. Independent temporary indexes reuse their root generation prefix; legacy names never authorize an inferred sibling cleanup.Validation:
temp_ddl_transactions.sqlon a native service: 124/124 statements in each of two rounds on the same instance, with zero failed/ignored/abnormal statements and zero test databases remaining after each round. Includes external database removal followed by stored-procedure DROP error, recreation and successful DML.