Repository navigation
fix: refresh persisted collation metadata on tenant upgrade - #30485
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of aefa885 against b111224. No blocking finding.
The forward 4.0.16 tenant migration is necessary: changing only the old 4.0.6 step cannot repair tenants that already passed it. The implementation uses the existing UpgradeEntry/tenant transaction/version-selection owners, derives both population and completion checks from the canonical collation definitions, and replaces the old predicate implementation with delegation to that same owner. No separate registry, recovery state, storage or query execution path is added.
Reviewed all eight changed files: implementation +153/-27; Go tests +408/-1; no documentation changes. Most tests exercise real behavior through the shared single-CN fixture, frontend SELECT/SHOW and MaybeUpgradeTenant, with an independent expected set. They cover six-row and empty historical tables, all seven stale fields, same-count duplicates, account isolation, idempotence, and rollback/retry after the real DELETE succeeds and INSERT fails. The smaller unit matrix covers protocol and SQL failures and result cleanup. One fixture is shared across the scenarios.
The metadata replacement and tenant-version advance remain in the existing transaction; failures are returned to its rollback owner. Existing protocol-118 compatibility is retained. I also traced the actual login entry: it bypasses a tenant newer than the serving CN, so an isolated call to the internal version checker is not evidence of a normal old-CN login regression.
Performance impact is confined to the one-time tenant migration over the small metadata table. Already-matching rows avoid DELETE/INSERT, and ordinary execution adds no per-row work. I found no demonstrated material performance regression.
Validation: exact-head build, UT/race, coverage, SCA and enabled BVT jobs pass in run 39042926996. The UT log and attempt-2 summary show TestCollationsMetadataUpgrade running and the owning sqlintegration race batches/package finishing successfully. Reviewed the author's additional 13-subtest local run and full affected-package results; I did not rerun those integration tests locally. No outstanding human review comments were present.
Approving this revision; the linked issue can remain open for reporter verification as described.
Merge Queue Status
This pull request spent 1 hour 52 minutes 5 seconds in the queue, including 54 minutes 19 seconds running CI. Required conditions to merge
|
…6581cf8c9c223801078f67d7fb47a43ef711528
|
独立实测:main 4.2-dev 未做旧二进制滚动升级、全仓库CI或完整MySQL collation兼容认证。 |
What type of PR is this?
Which issue(s) this PR fixes:
What this PR does / why we need it:
Existing tenants can retain empty or outdated
information_schema.COLLATIONSdata whileSHOW COLLATIONreads the current supported list. Fresh initialization already populates the table, but the only refresh was in the old 4.0.6 migration. In particular, tenants at catalog version 4.0.13 can retain six rows after native Unicode support expanded the advertised list to eight.Add a forward 4.0.16 tenant migration, gated on protocol 118, that checks the row count and all seven metadata fields against the canonical definitions. It replaces stale rows inside the existing upgrade transaction and skips replacement when the data already matches. The old and new migrations share the exact completion predicate. Work is bounded by the small metadata table and occurs during upgrade.
Regression coverage uses the existing single-CN SQL fixture and the real MySQL frontend and tenant-upgrade selection. It checks fresh system/new tenant results, legacy six-row and empty tables, full SELECT/SHOW parity, each stale metadata field, duplicate rows, idempotence, account isolation, and rollback plus retry after an injected insert failure. The failure case verifies that the real DELETE rolls back and the tenant version remains unchanged.
Validation (Go 1.27.1, macOS arm64, CPU native libraries):
pkg/util/sysview,pkg/bootstrap,pkg/bootstrap/versions/v4_0_6, andpkg/bootstrap/versions/v4_0_16.mo-cgo-test -v -count=1 -timeout=20m -run '^TestCollationsMetadataUpgrade$' ./pkg/tests/sqlintegrationpassed all 13 subtests. Scenario execution took 1.08 seconds; the package took 38.8 seconds including cluster admission and startup.CI is pending. Leave #30469 open for the reporter to verify after merge.