Skip to content

Clarify snapshot restore and branch merge diagnostics - #29958

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-29888-c4e8d7e4
Oct 13, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-29888-c4e8d7e4

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Oct 12, 2026 •

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 #29888

What this PR does / why we need it:

Root causes

  • The MySQL grammar supports snapshot restore through the brace-style snapshot option, but has no productions for the reported RESTORE ... FROM SNAPSHOT forms. Those inputs therefore fall through to generic parser errors without actionable syntax guidance.
  • Hash-diff expands an UPDATE into physical DELETE/INSERT batches and retains fromUpdate provenance. The FAIL diagnostic printed the physical kinds and claimed the values differed, although that path only identifies a matching primary key and does not compare endpoint values.

Changes

  • Add narrow grammar diagnostics for database, qualified database, and account FROM SNAPSHOT forms. They use the existing parser error path to point to RESTORE DATABASE [account.]database{snapshot="snapshot_name"}. The supported brace-style restore AST and execution remain unchanged.
  • Add batchWithKind.logicalOperation() to report UPDATE when fromUpdate is set, while preserving existing operation names for other batches. Use it in the hash-diff FAIL diagnostic and remove the unsupported “with different values” claim. Conflict detection and merge policy behavior are unchanged.
  • Add parser and actual hash-diff regression coverage, including both sides updating a row to the same non-ancestor value. Extend snapshot and branch-merge BVTs for the unsupported syntax hint, supported restore data, same-value conflict wording, explicit/default FAIL atomicity, SKIP, and ACCEPT. Update the existing merge result for the corrected message.
  • Refresh five existing branch BVT result files for nine stale expected diagnostics across branch_binary_pk, branch_float_special_values, branch_fractional_temporal_pk, branch_matrix_coverage, and merge_3. The fixtures now expect retained UPDATE provenance, while genuine DELETE conflicts omit the unsupported value-difference claim.

Issue-to-test proof

Validation

  • make -C pkg/sql/parsers/dialect/mysql — generated parser is current; regeneration during implementation reported zero grammar conflicts.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -run '^TestRestoreSnapshotFromSyntaxHint$' -count=1 -timeout=120s ./pkg/sql/parsers/dialect/mysql — passed.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/sql/parsers/dialect/mysql — passed.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -run '^(TestHashDiffConflictReportsExpandedUpdatesWithoutValueClaim|TestBatchWithKindLogicalOperation)$' -count=1 -timeout=120s ./pkg/frontend — passed.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/frontend — passed.
  • NATIVE_BUILD_JOBS=4 make build — completed successfully for PR head d2de51e389c9cc98d8f48cb0cff6fe880ca3c437.
  • The pre-correction PR-head CI run 38204783727 failed Compose Proxy BVT job 114667309931 on nine stale expected diagnostic lines in the five fixtures listed above. The job's actual outputs match the corrected expectations; no production code was changed for this CI failure.
  • After refreshing the fixtures, local mo-tester run mode passed the seven affected branch scripts at 786/786 (all SQL checks successful). The runner used /tmp/issue_29888_bvt_head_20261012/run3/mo.yml and run.yml for an isolated PR-head service on port 6002; no files in mo-tester were modified. Exact invocation, from /tmp/issue_29888_bvt_head_20261012/run3:
java -Xms1024M -Xmx1024M -cp '/Users/ghs-mo/MOWorkSpace/mo-tester:/Users/ghs-mo/MOWorkSpace/mo-tester/lib/*' io.mo.Tester 'path=/Users/ghs-mo/MOWorkSpace/tmp/issue-fix/issue-fix-loop/state/worktrees/issue-29888-c4e8d7e4/test/distributed/cases/' 'method=run' 'rate=100' 'include=branch_binary_pk,branch_float_special_values,branch_fractional_temporal_pk,branch_matrix_coverage,merge_3,merge_issue_29888,merge_2' 'ignore' 'nometa' 'resource=/Users/ghs-mo/MOWorkSpace/tmp/issue-fix/issue-fix-loop/state/worktrees/issue-29888-c4e8d7e4/test/distributed/resources'
  • git diff --check — clean after the fixture updates.

  • ISSUE_WS='/Users/ghs-mo/MOWorkSpace/tmp/issue-fix/issue-fix-loop/state/worktrees/issue-29888-c4e8d7e4' && export GOWORK=off CGO_CFLAGS="-I$ISSUE_WS/cgo -I$ISSUE_WS/thirdparties/install/include" CGO_LDFLAGS="-L$ISSUE_WS/thirdparties/install/lib -L/opt/homebrew/lib" && go vet -mod=readonly ./pkg/frontend ./pkg/sql/parsers/dialect/mysql — passed.

  • golangci-lint run -c .golangci.yml --new-from-rev origin/main ./pkg/frontend ./pkg/sql/parsers/dialect/mysql — 0 issues with the same CGo environment.

  • gofmt -l on changed Go files and git diff --check origin/main...HEAD — clean.

  • After rebasing on current main 64b7a43852627aeef568d7bd43a5e11c87872990, the generated parser is current and the focused parser/frontend regressions pass on the rebased source:

    • make -C pkg/sql/parsers/dialect/mysql — generated parser up to date.
    • ./.agents/skills/mo-dev/scripts/mo-cgo-test -run '^TestRestoreSnapshotFromSyntaxHint$' -count=1 -timeout=120s ./pkg/sql/parsers/dialect/mysql — passed.
    • ./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestDataBranchOutputAppendBatchRowsAsSQLValues|TestHashDiffConflictReportsExpandedUpdatesWithoutValueClaim|TestBatchWithKindLogicalOperation)$' ./pkg/frontend — passed.

Residual risks

  • RESTORE ... FROM SNAPSHOT remains unsupported; this change gives it an explicit pointer to the supported brace syntax, as allowed by the issue. The generated parser state tables have broad numbering churn, but regeneration reported zero conflicts and the final parser tests pass.
  • The branch FAIL policy continues to conflict on the matching key even when both endpoints have the same non-ancestor value. This PR corrects only the diagnostic; tests confirm the conflict policy and data preservation remain unchanged.
  • The fixture correction was covered on PR head f53ff46 by remote CI run 38216547624: UT Test, UT Coverage, SCA, Compose Proxy, multi-CN BVT, Coverage, and CI Required all passed. A fresh run will be triggered for the rebased head.

Latest rebase validation

  • Rebased the PR onto matrixorigin/matrixone main 1abfd6081b494dc6ab99d53805c1cc209883914d. The conflict was in generated parser output: upstream added SHOW GRANTS FOR CURRENT_USER while this PR adds the restore syntax diagnostic. The merged grammar and parser tests retain both behaviors; make -B -C pkg/sql/parsers/dialect/mysql regenerated the parser with zero conflicts.
  • make -C pkg/sql/parsers/dialect/mysql — generated parser is up to date.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -run '^(TestRestoreSnapshotFromSyntaxHint|TestShowGrantsForCurrentUser)$' -count=1 -timeout=120s ./pkg/sql/parsers/dialect/mysql — passed.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestHashDiffConflictReportsExpandedUpdatesWithoutValueClaim|TestBatchWithKindLogicalOperation)$' ./pkg/frontend — passed.
  • git diff --check origin/main...HEAD — clean.

Latest main sync validation

  • Rebased the local PR branch onto current matrixorigin/matrixone main 35c8dd5854 (ci(python-sdk): activate root Actions workflow and dependency matrix (#30075)). The only conflict was generated pkg/sql/parsers/dialect/mysql/mysql_sql.go; regenerated it from the auto-merged grammar so the PR restore syntax diagnostic and upstream grammar changes are both retained.
  • make -B -C pkg/sql/parsers/dialect/mysql — parser regeneration completed; make -C pkg/sql/parsers/dialect/mysql confirms the generated parser is current.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/parsers/dialect/mysql — passed.
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestHashDiffConflictReportsExpandedUpdatesWithoutValueClaim|TestBatchWithKindLogicalOperation)$' ./pkg/frontend — blocked during compilation by current-main references in pkg/sql/plan/explain/sql_json.go to plan.Node_VECTOR_INDEX_SCAN and plan.VectorIndexScan, which are absent from the unchanged pkg/pb/plan package. Neither path is changed by this PR; no unrelated workaround was added.
  • git diff --check origin/main...HEAD — clean. The rebased PR diff remains limited to the issue’s frontend diagnostics, parser hint, and related regression tests/fixtures.

@gouhongshen

gouhongshen commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

The unrelated setup-go TLS failure in #27127 remains tracked as an intermittent runner-proxy issue (open, no fix yet); its affected jobs (pr-size-label, Connector/J) passed on the latest heads. The EXPLAIN JSON/protobuf compile failures formerly tracked in #30108 are resolved: main fixed the breakage in #30111, this branch includes it, and on head f0410d5 every previously affected job passed (shared build, UT test, SCA, coverage eligibility, both multi-CN BVT jobs, Connector/J), so #30108 was removed from the tracked blockers. Run 38396815808 (attempt 1) ended with UT Coverage failing in its "Checkout MatrixOne source" step (git fetch hung, 5-minute timeout; no test ran), the Coverage job failing downstream ("a required producer did not publish a complete coverage profile"), and CI Required failing as their aggregate — all transient runner-side checkout/infrastructure issues unrelated to this PR, with no matching existing issue. The branch was rebased onto current main 8586fa0 (head 78a7fde), which starts a fresh CI run, so the stale run was not rerun.

@gouhongshen
gouhongshen force-pushed the agent/issue-29888-c4e8d7e4 branch from 35cb181 to e404f06 Compare October 12, 2026 04:27
@gouhongshen
gouhongshen force-pushed the agent/issue-29888-c4e8d7e4 branch from e404f06 to d2de51e Compare October 12, 2026 04:41
@gouhongshen
gouhongshen force-pushed the agent/issue-29888-c4e8d7e4 branch from 6207b58 to cbb1529 Compare October 12, 2026 10:03
@gouhongshen
gouhongshen force-pushed the agent/issue-29888-c4e8d7e4 branch from cbb1529 to f44125b Compare October 12, 2026 10:20
@gouhongshen
gouhongshen force-pushed the agent/issue-29888-c4e8d7e4 branch from f44125b to b20d30a Compare October 12, 2026 10:23
@gouhongshen
gouhongshen force-pushed the agent/issue-29888-c4e8d7e4 branch from b20d30a to 3affb7a Compare October 12, 2026 10:43
@XuPeng-SH

XuPeng-SH commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 78a7fdef4359b24718bd2ade8e5fa54d0419ffa3

Assessment: approve

Reviewed the complete 16-file delta and surrounding callers. Both fixes reuse existing ownership, correct misleading diagnostics, and preserve restore execution and merge policies. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-8e48-7622-ad17-b605f08450ce · slot 1 · generation 0

Validation:

  • Verified the frozen patch against the assigned base/head and clean checkout. Reviewed parser cleanup, UPDATE provenance, conflict handling, and every changed regression fixture.

  • Regenerated mysql_sql.go: byte-identical output, zero grammar conflicts, and exactly five added semantic actions with existing actions unchanged. Successful receipt: attempt-1/checks/1791908483482576666-2.json; log: attempt-1/parser-audit.log.

  • Reused exact-head successful CI results for Ubuntu unit tests, coverage, static analysis, Compose Proxy BVT and multi-CN pessimistic BVT. Author-reported targeted tests and BVT runs provided supporting evidence.

  • Preserved detailed reconciliation in attempt-1/review-evidence.json.

Limitations:

  • The packet lacks per-test CI logs, retained native execution artifacts and the full linked issue text. Native unit/BVT suites were not rerun locally.

  • Approval covers the diagnostic-only contract: FROM SNAPSHOT remains unsupported, and equal non-ancestor endpoint values still conflict under FAIL.

@XuPeng-SH XuPeng-SH 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.

mo-bot review · mo-bot-local · review

Commit: 78a7fdef4359b24718bd2ade8e5fa54d0419ffa3

Assessment: approve

Reviewed the complete 16-file delta and surrounding callers. Both fixes reuse existing ownership, correct misleading diagnostics, and preserve restore execution and merge policies. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-8e48-7622-ad17-b605f08450ce · slot 1 · generation 0

Validation:

  • Verified the frozen patch against the assigned base/head and clean checkout. Reviewed parser cleanup, UPDATE provenance, conflict handling, and every changed regression fixture.

  • Regenerated mysql_sql.go: byte-identical output, zero grammar conflicts, and exactly five added semantic actions with existing actions unchanged. Successful receipt: attempt-1/checks/1791908483482576666-2.json; log: attempt-1/parser-audit.log.

  • Reused exact-head successful CI results for Ubuntu unit tests, coverage, static analysis, Compose Proxy BVT and multi-CN pessimistic BVT. Author-reported targeted tests and BVT runs provided supporting evidence.

  • Preserved detailed reconciliation in attempt-1/review-evidence.json.

Limitations:

  • The packet lacks per-test CI logs, retained native execution artifacts and the full linked issue text. Native unit/BVT suites were not rerun locally.

  • Approval covers the diagnostic-only contract: FROM SNAPSHOT remains unsupported, and equal non-ancestor endpoint values still conflict under FAIL.

@mergify

mergify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-13 16:24 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-13 16:26 UTC · at a5d47ada432ce180165fc6ead153d45da8f24c97

This pull request spent 2 minutes 35 seconds in the queue, with no time running CI.

Reason

Pull request #29958 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch was successfully deployed

No deployments
ci — a5d47ada Deployed Oct 13, 2026 by mergify[bot]
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/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants