Skip to content

fix: invalidate prepared statements on newer table versions - #25670

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
aptend:fix/25600-25622-prepared-schema-version
Jul 13, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
aptend:fix/25600-25622-prepared-schema-version

Conversation

@aptend

@aptend aptend commented Jul 13, 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 #25600
Fixes #25622

What this PR does / why we need it:

Correct the table-version comparison used to invalidate prepared statements after schema changes. A catalog entry is newer when its version is greater than the version captured during prepare.

Add regression coverage for newer, equal, and timestamp-ineligible catalog versions.

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

LGTM after reviewing this from the catalog-version, prepared-invalidation, and unhappy-path angles.

  • correctness: HasNewerVersion now treats a table entry as newer only when its captured version is greater than the prepared-plan version, which matches the invalidation contract described by the issues
  • scope: the change is tight and preserves the existing timestamp gating, table-ID mismatch handling, and deletion invalidation behavior
  • unhappy path coverage: the new regression covers newer, equal, and timestamp-ineligible catalog versions, which are the three comparison cases that matter here

I did not find a remaining correctness or hang issue in the latest diff, so approving.

@mergify mergify Bot added the queued label Jul 13, 2026
@mergify

mergify Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-13 11:49 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-07-13 12:21 UTC · at ea0f8809f4249d113199fb8e6e69e23bdd656825

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

Reason

The pull request can't be updated

This pull request seems to come 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, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

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

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 6b4e44c into matrixorigin:main Jul 13, 2026
23 of 24 checks passed
@mergify mergify Bot added dequeued and removed queued labels Jul 13, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…igin#25670)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#25600
Fixes matrixorigin#25622

## What this PR does / why we need it:

Correct the table-version comparison used to invalidate prepared
statements after schema changes. A catalog entry is newer when its
version is greater than the version captured during prepare.

Add regression coverage for newer, equal, and timestamp-ineligible
catalog versions.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…igin#25670)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#25600
Fixes matrixorigin#25622

## What this PR does / why we need it:

Correct the table-version comparison used to invalidate prepared
statements after schema changes. A catalog entry is newer when its
version is greater than the version captured during prepare.

Add regression coverage for newer, equal, and timestamp-ineligible
catalog versions.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…igin#25670)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes matrixorigin#25600
Fixes matrixorigin#25622

## What this PR does / why we need it:

Correct the table-version comparison used to invalidate prepared
statements after schema changes. A catalog entry is newer when its
version is greater than the version captured during prepare.

Add regression coverage for newer, equal, and timestamp-ineligible
catalog versions.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
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/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Prepared SELECT returns a different column after RENAME COLUMN [Bug] prepared statement execution panics after column ADD followed by RENAME

4 participants