Skip to content

fix(compile): isolate historical snapshot transactions per scan - #32415

Merged
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
ck89119:issue-32407-main
Nov 9, 2026
Merged

XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
ck89119:issue-32407-main

Conversation

@ck89119

@ck89119 ck89119 commented Nov 9, 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:

Fixes #32407

What this PR does / why we need it:

Mixed historical snapshots currently reuse the first snapshot transaction stored on the Process, silently returning incorrect rows and historical column metadata.

  • Bind each relation opening to its requested snapshot transaction instead of sharing the Process's unkeyed clone slot.
  • Keep reader and tombstone collection on the transaction already bound to the relation, preserving existing tenant and publication context handling.
  • Keep IVF hidden-table snapshot reuse local to its reader execution; preserve the existing shared search-generation lifecycle.
  • Add regression coverage for distinct physical/logical timestamps, concurrent selection, execution reuse, error propagation, JOIN/UNION/CTE/View reads, updates/deletes, historical metadata, actual binary prepared execution, and remote multi-CN pipelines.

Validation (Go 1.27.1, darwin/arm64, ordinary CPU build):

  • New unit regressions and real SQL witnesses fail on the unfixed revision with the reported timestamp and result mismatches.
  • Full compile and IVF package tests pass, including full-package race runs; focused concurrent selection also passes 100 race repetitions.
  • Real COM_STMT_PREPARE/EXECUTE, repeated execution interleaved with current reads, historical metadata, peer-CN entry, and forward/reverse remote pipeline execution pass.
  • New SQL BVT passes twice: 46/46 each, including a metadata-comparison run. Existing historical table-clone BVT passes 23/23. Database/snapshot cleanup is verified and the owned service exits normally.
  • Changed production coverage blocks: 78.8%; both new snapshot-selection helpers: 100%.
  • gofmt, vet, and golangci-lint 2.14.0 pass for the changed packages. Ordinary mo-service build passes.

Repository-wide tests/SCA, the full issues integration package, and GitHub CI have not been claimed as passed.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: f70ea4fc16118a725d33a869b1147a6ef5467d44

Review completed. Read the assessment.

@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: f70ea4fc16118a725d33a869b1147a6ef5467d44

Assessment: approve

Relation-local historical transactions fix mixed-snapshot reads while preserving tenant context. The shared helper and reader-local IVF reuse fit existing ownership without new global state. No actionable findings.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Go 1.27.1 CPU/native checks passed; source and retained receipts/logs verified in check-reconciliation.json.

  • Compile and IVF packages passed normal and race runs: 1,853 root tests in each mode.

  • Eight focused tests passed 100 race repetitions each; the binary prepared/multi-CN regression passed two race repetitions.

  • SQL BVT passed 46/46 twice on one instance and 46/46 with metadata comparison; teardown verified.

  • Unfixed-production control reproduced the incorrect logical timestamp.

Limitations:

  • The full issues integration package and repository-wide suites were not rerun locally.

@mergify mergify Bot added the queued label Nov 9, 2026
@mergify

mergify Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

32 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Mon 9 Nov, 15:43 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 16:15 · 4e33092

Reason

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

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

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

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mixed historical snapshots reuse one read timestamp and return incorrect rows

3 participants