Skip to content

fix(view): decode signed account IDs in metadata admission - #27770

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-27768-7ca758bd
Aug 28, 2026
Merged

fix(view): decode signed account IDs in metadata admission#27770
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-27768-7ca758bd

Conversation

@gouhongshen

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:

Related to #27768

What this PR does / why we need it:

Root cause

The catalog declares mo_catalog.mo_account.account_id as signed INT, which is the T_int32 vector type. The view-metadata admission fence read that result with vector.MustFixedColNoTypeCheck[uint32]. Race builds validate no-type-check vector access and panic when an INT vector is cast to []uint32. The former bounded-page fixture also used T_uint32, so it did not exercise the catalog type contract.

A pre-change race run with the fixture corrected to T_int32 reproduced the reported panic at view_metadata_recovery.go:157; the ordinary build passed because the no-type-check helper is unchecked outside race builds.

Changes

  • Add one shared decoder for the account page that requires T_int32, validates the result shape and values, uses checked int32 reads, and converts valid IDs to the internal uint32 representation.
  • Propagate a bounded internal error from the page callback and close the result before returning.
  • Decode the complete page before any mo_view_dependencies writes, preserving failure atomicity.
  • Keep the existing 32-row page limit, cursor advancement, dependency generation, and admission fencing unchanged.
  • Change the bounded-page fixture to the actual T_int32 catalog type and add invalid-page regression cases for wrong type, negative ID, and batch/vector length mismatch. Each case asserts no panic, an error, and no metadata write.

BVT is not appropriate for this issue: SQL BVTs cannot directly control the internal executor vector type at this boundary. The focused compile UTs and the exact embedded-cluster issue test cover both the typed handoff and the public admission path.

Issue-to-test proof

  • TestSeedViewMetadataRevalidationPageIsBounded supplies 32 signed INT32 account IDs and verifies bounded pagination and cursor advancement.
  • TestSeedViewMetadataRevalidationPageRejectsInvalidAccountPage covers an unexpected UINT32 vector, a negative signed ID, and a row-count/vector-length mismatch; it verifies panic-free error handling and that no replacement/update follows a rejected page.
  • TestIssue26114CrossAccountBranchQuotaAndOwnership exercises the reported embedded-cluster path, including both target_quota_and_ownership and legacy_metadata_counts_toward_target_quota.

Tests run

  • .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run ^TestSeedViewMetadataRevalidationPage(IsBounded|RejectsInvalidAccountPage)$ ./pkg/sql/compile
  • Same focused test command with -race
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run ^TestIssue26114CrossAccountBranchQuotaAndOwnership$ ./pkg/tests/issues/isolated
  • Same issue command with -race
  • Same issue command with -race -count=2
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s ./pkg/sql/compile

All listed commands passed.

Residual risks

The change is limited to decoding the account discovery page. A malformed catalog result now returns an internal error through the existing admission/recovery error path instead of panicking; generation fencing and bounded progress SQL are unchanged. The local exact race integration test was nondeterministic before the fix, but the corrected internal-vector regression deterministically reproduces the original panic and now passes in race mode.

@mergify mergify Bot added the kind/bug Something isn't working label Aug 27, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Aug 27, 2026
@gouhongshen
gouhongshen force-pushed the agent/issue-27768-7ca758bd branch from 69fe797 to 9ec7540 Compare August 28, 2026 00:58
@gouhongshen
gouhongshen force-pushed the agent/issue-27768-7ca758bd branch from 9ec7540 to 58c2db3 Compare August 28, 2026 01:23
@gouhongshen

gouhongshen commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Unrelated CI blockers: the Ubuntu/x86 race UT has two unrelated, separately tracked failures.

@gouhongshen
gouhongshen marked this pull request as ready for review August 28, 2026 03:11

@aptend aptend 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.

Reviewed the exact head fea15e1. The signed INT32 catalog decode, page-shape validation, error propagation, result closure, and decode-before-write atomicity are consistent with the executor and catalog contracts. Focused normal and race tests, build, and vet passed.

@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@gouhongshen

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-28 06:37 UTC · Rule: main · triggered by @gouhongshen with the @mergifyio queue command
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-28 06:37 UTC · at fea15e1bb145f15bec0ae5f592a048e929ca6b73 · squash

This pull request spent 20 seconds in the queue, including 2 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

@mergify mergify Bot added the queued label Aug 28, 2026
@mergify
mergify Bot merged commit 28769ff into matrixorigin:main Aug 28, 2026
33 checks passed
@mergify mergify Bot removed the queued label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants