Repository navigation
fix(frontend): align PITR publication query projection with its row parser (#30607) - #30643
Conversation
…arser (matrixorigin#30607) RESTORE DATABASE ... FROM PITR reads the restored database's publications through getPubInfoWithPitrFormat, which projected mo_pubs as (pub_name, database_name, ...). createPubByPitr then parsed the rows with extractPubInfosFromExecResult, which expects the 12-column layout starting with (account_id, account_name). The pub name landed in the first column and restore aborted with "strconv.ParseInt: parsing \"<pub_name>\": invalid syntax", so a published database could never be restored via PITR (while the same restore succeeded for unpublished databases). Make the PITR query project the same 12-column layout as the extractor, matching getAllPubInfosBySnapshotName's already-correct snapshot query. Regression tests pin the projection against getPubInfoSql and verify a realistic row parses into the right PubInfo fields; both fail on main.
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 40a6ef5 (isolated 1 LogService / 1 TN / 1 CN, fresh stores, exact reporter recipe with Baseline (upstream/main @ 983ab88) This fix Unit: |
|
mo-bot review · Commit: "interrupted" |
|
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: 6901c2077ed1d14c74a19ff75074f02737851277
Assessment: request_changes
The projection correction appropriately reuses the existing row extractor. However, it enables successful restores that silently swap publication owner and creator IDs. Reviewed all three changed files and their restore consumers; one actionable correctness issue remains.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P2
pkg/frontend/pitr.go:78: Restore a published database whose publication creator user ID differs from its owner role ID, such as a publication created by dump.
Impact: RESTORE succeeds but persists incorrect publication ownership and creator metadata. Complete the replay fix by supplying Creator as the user ID and Owner as the role ID, and test successful nonempty publication replay with distinct IDs.
Evidence: The current-head native MySQL test restored the expected rows but changed (owner=0, creator=1) to (owner=1, creator=0). createPubByPitr at line 2655 passes Owner, Creator to AttachAccount, whose arguments are userId, roleId; the catalog writer then stores roleId, userId. This inversion predates the patch, but the corrected projection makes it reachable: the base-projection control aborts earlier with the original ParseInt error. See public-pitr.log and base-control.log.
Validation:
-
Artifacts are retained under /home/xupeng/.local/state/mo-bot/jobs/9b8874ac71f91b3ebb0c7bb0/attempt-1. review-evidence-audit.json reconciles commands, input hashes, native provenance, logs and receipts; source remains unchanged.
-
Isolation preflight and repository-owned native build passed. Tests used the assigned caches and supplied test-exec.
-
Complete frontend suite passed, including the new layout regression and legacy extractor tests: frontend-normal.log; receipt 1792475414204663283-3.json, exit 0.
-
Current-head public RESTORE probe failed the ownership-preservation assertion: public-pitr.log; receipt 1792475490635437218-3.json, exit 1.
-
The base pitr.go overlay reproduced the original ParseInt error as expected: base-control.log; receipt 1792475545620675462-3.json, exit 0.
-
The change adds two required projected fields without changing query count, filters or ordinary SELECT/DML/DDL paths. Design, test-quality and compatibility analysis is retained in review-scope-notes.json.
Limitations:
-
The author’s live report references an earlier head without retained execution artifacts here; current-head conclusions rely on local validation.
-
No cross-version, multi-CN or performance benchmark was run. Native validation used one isolated LOG/TN/CN cluster per test binary.
-
Initial setup receipts lack Git fingerprints because they ran outside the checkout; native build and all test receipts identify the exact clean head.
|
mo-bot review · Commit: Review belongs to an older commit; it is not a review of the current head. |
|
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: e42ce6d836799f8c3469acd83277b688cba00885
Assessment: approve
Reviewed all three changed files and their restore consumers. The fix correctly aligns the projection with the existing extractor and preserves publication owner/creator identities. It retains existing transaction and cleanup ownership, adds no queries or normal SQL-path work, and closes the prior finding.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Isolation preflight passed; recovered native artifacts matched current inputs and passed repository provenance verification.
-
Current-head frontend suite passed: 2,483 top-level passes and one preexisting skip. frontend-normal.log; receipt 1792485617462659868-3.json, exit 0.
-
Current-head public MySQL RESTORE probe passed: restored rows [1,2], correct publication database reference and metadata, and unchanged owner=0/creator=1. public-pitr.log; receipt 1792485656707634448-3.json, exit 0.
-
Retained negative-control logs, commands and hashes were independently reconciled. Source, overlays and current execution receipts are audited in /home/xupeng/.local/state/mo-bot/jobs/5a99c97c3a66d4e69af274cb/attempt-1/validation-audit.json; all 11,609 tracked files remained unchanged.
Limitations:
-
Public validation used one isolated LOG/TN/CN cluster; no cross-version or multi-CN restore run or performance benchmark was performed.
-
The standalone linked issue body was not supplied; its scenario was assessed from the frozen PR description and comments.
Merge Queue Status
This pull request spent 4 hours 49 minutes 45 seconds in the queue, including 1 hour 9 minutes 11 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #30607
What this PR does / why we need it:
RESTORE DATABASE ... FROM PITRfails for any database referenced by a publication:and the database is left unrestored.
Root cause
pkg/frontend declares two
mo_pubscolumn layouts (post/preaccount_name). The restore path increatePubByPitrqueries withgetPubInfoWithPitrFormat, which used a third, shortened projection starting atpub_name— while the rows were parsed byextractPubInfosFromExecResult, which readsaccount_id(int64) at column 0. The publication name string landed in that slot andstrconv.ParseIntrejected it. The sibling snapshot path (getAllPubInfosBySnapshotName) already queried the correct 12-column layout.Fix
Make
getPubInfoWithPitrFormatproject the same 12-column layout as the extractor:(account_id, account_name, pub_name, database_name, database_id, table_list, account_list, created_time, update_time, owner, creator, comment). One-line production change; all other readers audited and already consistent.Tests
Test_getPubInfoWithPitrLayout: pins the PITR query's projection equal togetPubInfoSql's and parses a realistic row into the rightPubInfofields; fails on main (proven).Test_createPubByPitrrow fixtures migrated to the real 12-column shape;newMrsForSqlForGetPubsbuilder updated to match.go test ./pkg/frontend/all pass.Live end-to-end (exact issue scenario, isolated 1 LOG/1 TN/1 CN)
Baseline binary: bug reproduces verbatim —
ERROR 1105: strconv.ParseInt: parsing "pubpxb": invalid syntax.Fixed binary (fresh store):