Repository navigation
fix(bootstrap): recheck CDC watermark prerequisites in the 4.0.11 upgrade (#30215) - #30642
Conversation
…rade (matrixorigin#30215) Clusters first deployed at catalog 4.0.6 (shipped as v4.2.5) never execute the v4_0_6 cluster handler: their upgrade chain starts at step 4.0.6 -> 4.0.7, driven by the v4_0_7 list. The entries adding mo_cdc_watermark columns source_table_id and owner_generation were merged into the already-consumed v4_0_6 handler after the v4.2.5 cut. Those clusters then reach 4.0.10 -> 4.0.11, whose pending_source_table_id ALTER anchors after owner_generation, and the upgrade aborts with "Unknown column 'owner_generation'", leaving checkTenantUpgrade failing and SQL login permanently blocked. Recheck both prerequisite columns at the head of the v4_0_11 cluster list, ahead of the entries anchored on them. Each addition is gated by the existing column CheckFunc, so stores that did run the v4_0_6 handler upgrade identically with no extra DDL. Verified end to end: a fresh v4.2.5 (1a44f3d) store upgraded by an unfixed main binary reproduces the reported missing-column failure and 1815 login block; the same store upgraded (and, separately, recovered after the failed attempt) by this fix completes the chain to 4.0.17, adds all four columns, preserves user rows, and restores authenticated logins.
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? |
|
Local verification at head 6994c12, exact reporter scenario (1 LogService / 1 TN / 1 CN, fresh fresh-store init each time): Store A — straight upgrade path
Store B — bug repro on unfixed main, then recovery
Unit: |
|
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-xupeng · review
Commit: 91b2d51bf726780763657c808212e410b94ad659
Assessment: request_changes
The prerequisite repair is correctly ordered and idempotent, but it changes the persisted 4.0.11 handler identity and breaks interrupted-upgrade recovery.
Model: gpt-6-astra / xhigh
Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0
- P1
pkg/bootstrap/versions/v4_0_11/cluster_upgrade_list.go:38: Start the candidate against a store with an unfinished upgrade targeting catalog 4.0.11, offset 2—the identity advertised when 4.0.11 was the final registered handler.
Impact: Adding these entries changes VersionOffset from 2 to 4 because upgrade.go:32 derives it from the list length. canResumeUpgrade rejects the mismatch, and doCheckUpgrade takes its Fatal path before running the repair. Preserve the historical offset and add a recovery regression using the real registered handler.
Evidence: service_upgrade.go:312 requires exact offset equality; lines 186–193 reject an unfinished incompatible target. TestReviewRetainedCDCUpgradeTarget passed its offset-2 metadata control but failed with the actual candidate handler. Retained evidence: upgrade-tests.log and checks/1792484762702901382-2.json under the assigned diagnostic directory.
Validation:
-
Reviewed the complete delta, migration prerequisites, schema consumers, protocol gates, transaction ownership, and recovery coordinator.
-
Isolation preflight passed; native prerequisites were built and provenance verified through repository owners.
-
Both v4_0_11 tests passed, including all six admission scenarios. The additional recovery diagnostic reproduced the finding; the combined command exited 1.
-
Reconciled commands, exact-head fingerprints, exit receipts, and retained logs in validation-audit.json. Source and diagnostic clone remain clean.
Limitations:
-
No live database upgrade or restart was executed; the diagnostic exercised the real recovery-admission method.
-
The full bootstrap suite was not run. Author live-upgrade reports concern an earlier commit and lack retained execution receipts in the supplied evidence.
|
Addressed both reviews in The 4.0.11 handler now retains its published Added Validation on macOS arm64 / Go 1.27.1:
Before this update, the existing head's CI checks, including the rerun Ubuntu UT, were all successful. The pushed commit starts a new CI run; its results are pending. |
|
Reviewed the complete four-file delta at No new blocking finding; approve from the source-review perspective, subject to required CI completing successfully.
Validation limits: This is a review comment only, not a formal GitHub approval or a claim that CI is green. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
|
mo-bot review · Commit: Review belongs to an older commit; it is not a review of the current head. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: abe5af055cbbe44561e489e17706725de7d0e008
Assessment: approve
Reviewed the complete four-file delta and affected callers. The prerequisite checks correctly reuse the existing migration executor, preserve ordering and protocol gating, and propagate failures through the transaction owner. Pinning offset 2 closes both earlier recovery findings without weakening identity checks. Added costs are confined to upgrade attempts; no ordinary SQL path changes. No unresolved actionable findings.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Frozen current-head CI reports successful Ubuntu UT, coverage, Linux/arm64 static analysis, shared build, and both BVT legs. The author also reports focused recovery/admission tests and the bootstrap suite passing at this head.
-
Independently reconciled six retained command/source/exit receipts and log hashes. Verified 11,609 prior tracked inputs and 190 unchanged native inputs. Reused 12 CDC partial-schema and failure-boundary cases whose execution logic remains unchanged; earlier recovery failures were treated only as historical controls.
-
Verified the new regression uses the production registry, literal historical offset 2, pending and completed cluster steps, retained-route reads, and rejection of offset 4.
-
Local source/evidence audit and git diff --check passed; source remained unchanged. Receipt: checks/1792491301464133314-4.json. Detailed evidence: /home/xupeng/.local/state/mo-bot/jobs/2028fa31f5d376ac6f8abad9/attempt-1/validation-audit.json.
Limitations:
-
No Go tests or live-store upgrade were rerun in this attempt. Current-head CI evidence contains terminal statuses, not raw per-test logs.
-
Upgrade-compatibility jobs were skipped. The historical v4.2.5 live-upgrade report lacks retained raw logs and is not claimed as independently verified current-head execution.
-
The linked issue's full body was not supplied; review covered the concrete failure and recovery contract documented in the supplied PR and comments.
Merge Queue Status
This pull request spent 3 hours 39 minutes 44 seconds in the queue, with no time running CI. ReasonPull request #30642 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. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #30215
What this PR does / why we need it:
A fresh official v4.2.5 store (catalog 4.0.6) cannot become SQL-ready on current main. The catalog upgrade aborts at step
4.0.10 -> 4.0.11with:checkTenantUpgradekeeps failing, so authentication never completes and clients hit read timeouts.Root cause
The entries that add
source_table_idandowner_generationtomo_cdc_watermarklive in the v4_0_6 cluster handler — but they were merged there after the v4.2.5 release cut. A cluster first deployed at catalog 4.0.6 has already consumed the 4.0.6 step, so its upgrade chain starts at4.0.6 -> 4.0.7(driven by the v4_0_7 list) and those entries never run. The chain then reaches 4.0.11, whosepending_source_table_idALTER anchorsAFTER owner_generationon a column that does not exist.Fix
Recheck both prerequisite columns at the head of the v4_0_11 cluster list, before the entries anchored on them — same idiom already used by the v4_0_11 list itself ('columns deliberately introduced after 4.0.10'). Every entry is gated by its per-column
CheckFunc(skip if present), so:The handler retains its published
VersionOffset = 2, independently of the four checked entries. The two prerequisite checks repair the existing migration rather than introduce a new handler identity. This preserves recovery of stores with an unfinished(4.0.11, offset 2)target.Tests
TestDoCheckUpgradeRetainsHistoricalCDCWatermarkTarget, using the production registry and the persisted literal offset 2. It exercisescanResumeUpgradeanddoCheckUpgradefor both pending and already-completed cluster steps, verifies that the retained route is read without scheduling a replacement, and keeps mismatched offsets rejected. The test fails before the offset fix and passes after it.TestCDCWatermarkUpgradeAdmissionextended: prerequisites run ahead of the anchored columns, already-present columns are skipped (post-retrofit stores issue 0 DDL), protocol gates still block DDL until every CN reaches MORPCVersion106.TestCDCWatermarkColumnsUpgradeMetadatapins the new entry order.go test ./pkg/bootstrap/...all pass.Real upgrade-path verification (exact reporter scenario, local 1-LogService/TN/CN)
1a44f3db), initialized a fresh store, loaded the reporter's row(1,42); confirmed catalog4.0.6state 2 andmo_cdc_watermarkwithout the new columns. Clean SIGINT stop.309f618995) on a copy of that store → identical failure:Unknown column 'owner_generation',failed to handle version upgrade: 4th: 4.0.10 -> 4.0.11, loginERROR 1815 (HY000): context deadline exceeded / checkTenantUpgrade.4.0.6 → … → 4.0.17state 2, zero missing-column errors, login & data intact.