Skip to content

fix(stats): filter checkpoint table changes by collection window - #29337

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:codex/fix-changed-table-window-main
Sep 24, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
gouhongshen:codex/fix-changed-table-window-main

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

issue #29339

What this PR does / why we need it:

CollectChanged scans the checkpoint table-ID index to find tables changed within a requested time window. Its existing lower-bound check compares end with start instead of from, so valid historical index rows are never excluded. This can repeatedly schedule old table IDs for statistics recalculation.

Filter index ranges by overlap with [from, to], while preserving the existing invalid-range and upper-bound behavior. Add regression cases for historical, overlapping, boundary, future, and invalid ranges, plus a handler-level test that exercises the checkpoint index path. CheckChanged behavior is unchanged.

Validation: make cgo NATIVE_BUILD_JOBS=8; mo-cgo-test -count=1 -coverprofile=/tmp/matrixone-changed-table-window-main.cover -run '^(TestTableIDRangeIntersectsWindow|TestHandleGetChangedTableListCollectChangedUsesIndexWindow|TestTryGetChangedListFromTableIDBatchReadsCompleteIndex)$' ./pkg/vm/engine/tae/rpc; git diff --check.

@gouhongshen
gouhongshen marked this pull request as ready for review September 24, 2026 09:18
@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.

Reviewed exact head 168b630 against main merge-base d7d940e. No blocking findings. Verified inclusive collection-window overlap, historical/future/invalid range handling, checkpoint coverage fallback, and unchanged CheckChanged behavior. The focused helper and handler-path regressions plus successful exact-head CI run 35987506232 support approval.

@XuPeng-SH

Copy link
Copy Markdown
Contributor

@Mergifyio refresh

@mergify

mergify Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify mergify Bot added the queued label Sep 24, 2026
@mergify

mergify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-24 12:39 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-24 12:42 UTC · at 8bbce11b4f864d1620bf836ac2ca3140eb66b1a9

This pull request spent 2 minutes 50 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"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) 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 3063f44 into matrixorigin:main Sep 24, 2026
19 of 20 checks passed
@mergify mergify Bot added dequeued and removed queued labels Sep 24, 2026
XuPeng-SH pushed a commit that referenced this pull request Sep 24, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue #29339

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

Backport of #29337 to `4.2-dev`.

`CollectChanged` currently compares the checkpoint index row's `end`
with `start` instead of the requested lower bound `from`. Valid
historical rows therefore remain in every collection result and can
repeatedly schedule old table IDs for statistics recalculation.

Filter index ranges by overlap with `[from, to]`, preserving the
existing invalid-range and upper-bound behavior. Add regression cases
for historical, overlapping, boundary, future, and invalid ranges, plus
a handler-level test that exercises the checkpoint index path.
`CheckChanged` behavior is unchanged.

Validation on `4.2-dev`: `make cgo NATIVE_BUILD_JOBS=8`; `mo-cgo-test
-count=1 -coverprofile=/tmp/matrixone-changed-table-window-4.2.cover
-run
'^(TestTableIDRangeIntersectsWindow|TestHandleGetChangedTableListCollectChangedUsesIndexWindow|TestTryGetChangedListFromTableIDBatchReadsCompleteIndex)$'
./pkg/vm/engine/tae/rpc`; handler test also passed with `-count=10`;
`git diff --check`.

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.

3 participants