Repository navigation
fix: resolve table_stats in requested account - #25894
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? |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed head 74ac69e. No blocking defects found. The requested account context is used consistently for relation and GlobalStats lookup without mutating the shared process context, and account parsing and cross-account authorization have focused coverage.
|
Queued — the merge queue status continues in this comment ↓. |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No blocking findings. The target-account context is applied consistently to relation resolution and GlobalStats operations while preserving authorization and process-context isolation.
XuPeng-SH
left a comment
There was a problem hiding this comment.
No blocking findings after a full correctness / closure / unhappy-path pass.
The fix now carries the requested account context consistently through relation resolution and GlobalStats access without mutating proc.Ctx, and the stricter account_id parsing closes the old loose-parse edge cases. The added unit coverage plus distributed cross-account case cover the important same-account, forbidden tenant cross-account, and sys-to-tenant lookup paths.
Merge Queue Status
This pull request spent 27 minutes 47 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #25894 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.
Failing checks:
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
|
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25782 ## What this PR does / why we need it: Fixes the three-part `table_stats` path (`db.table.account_id`) so relation lookup and statistics access run in the requested account context. Previously, `table_stats` parsed `account_id` and placed it in `StatsInfoKey`, but resolved the database and table with the caller account context. A sys query for a tenant-only table therefore returned `database not found`; identical names could also combine the tenant account ID with sys relation IDs. The fix: - keeps cross-account authorization before engine access - derives a local target-account context without mutating the process context - reuses the current transaction operator - uses the target context for database/relation IDs and GlobalStats operations - strictly validates `account_id` as `uint32` - adds unit and distributed cross-account regression coverage Validation: - `make thirdparties` - `make build` - `go test ./pkg/sql/colexec/table_function` - `go test -race ./pkg/sql/colexec/table_function` - local disttae integration: tenant same-account lookup passed; tenant cross-account lookup was rejected; sys dynamic cross-account lookup returned the tenant table Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25782 ## What this PR does / why we need it: Fixes the three-part `table_stats` path (`db.table.account_id`) so relation lookup and statistics access run in the requested account context. Previously, `table_stats` parsed `account_id` and placed it in `StatsInfoKey`, but resolved the database and table with the caller account context. A sys query for a tenant-only table therefore returned `database not found`; identical names could also combine the tenant account ID with sys relation IDs. The fix: - keeps cross-account authorization before engine access - derives a local target-account context without mutating the process context - reuses the current transaction operator - uses the target context for database/relation IDs and GlobalStats operations - strictly validates `account_id` as `uint32` - adds unit and distributed cross-account regression coverage Validation: - `make thirdparties` - `make build` - `go test ./pkg/sql/colexec/table_function` - `go test -race ./pkg/sql/colexec/table_function` - local disttae integration: tenant same-account lookup passed; tenant cross-account lookup was rejected; sys dynamic cross-account lookup returned the tenant table Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#25782 ## What this PR does / why we need it: Fixes the three-part `table_stats` path (`db.table.account_id`) so relation lookup and statistics access run in the requested account context. Previously, `table_stats` parsed `account_id` and placed it in `StatsInfoKey`, but resolved the database and table with the caller account context. A sys query for a tenant-only table therefore returned `database not found`; identical names could also combine the tenant account ID with sys relation IDs. The fix: - keeps cross-account authorization before engine access - derives a local target-account context without mutating the process context - reuses the current transaction operator - uses the target context for database/relation IDs and GlobalStats operations - strictly validates `account_id` as `uint32` - adds unit and distributed cross-account regression coverage Validation: - `make thirdparties` - `make build` - `go test ./pkg/sql/colexec/table_function` - `go test -race ./pkg/sql/colexec/table_function` - local disttae integration: tenant same-account lookup passed; tenant cross-account lookup was rejected; sys dynamic cross-account lookup returned the tenant table Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #25782
What this PR does / why we need it:
Fixes the three-part
table_statspath (db.table.account_id) so relation lookup and statistics access run in the requested account context.Previously,
table_statsparsedaccount_idand placed it inStatsInfoKey, but resolved the database and table with the caller account context. A sys query for a tenant-only table therefore returneddatabase not found; identical names could also combine the tenant account ID with sys relation IDs.The fix:
account_idasuint32Validation:
make thirdpartiesmake buildgo test ./pkg/sql/colexec/table_functiongo test -race ./pkg/sql/colexec/table_function