Skip to content

test(tae): force scoped checkpoint before GC replay - #26033

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/issue-26031-checkpoint-wait-fence
Jul 22, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/issue-26031-checkpoint-wait-fence

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #26031

What this PR does / why we need it:

TestAppendAndGC2 used the generic global-quiescence waiter after its append
workload. That contract is not satisfiable in this test: it sets
CheckpointCfg.MinCount = 3, so a post-fence tail of one WAL entry is valid
background state and does not schedule another incremental checkpoint. CI
observed target LSN 201 already covered by checkpointed LSN 203, while current
LSN 204 remained pending.

The previous revision fenced only the numeric LSN but still sampled the live
checkpoint intent. That mixed generations in both directions: a newer pending
intent could extend the wait, while the nil interval between generations could
let the waiter return before the newer ICKP started. The latter happened in
TestAppendAndGC: the waiter returned and the following zero-pending
assertion observed 2 while the next ICKP was starting.

This revision leaves the shared waiter and checkpoint runner unchanged. Once
all append workers finish, TestAppendAndGC2 explicitly calls
ForceCheckpoint with TxnMgr.Now() under a 10-second context.
ForceCheckpoint waits on the checkpoint intent that covers that target TS,
so the test gets a target-scoped completion signal without chasing or sampling
a different generation. The change is test-only and does not affect MatrixOne
runtime behavior.

Validation:

  • TestAppendAndGC|TestAppendAndGC2: 20 iterations each
  • the same two tests under -race: 3 iterations each
  • full ./pkg/vm/engine/tae/db/test package
  • 16 representative shared-waiter callers, including checkpoint, GC, PITR,
    ISCP, snapshot, and replay tests
  • go vet ./pkg/vm/engine/tae/db/test ./pkg/vm/engine/tae/db/testutil
  • git diff --check

@LeftHandCold
LeftHandCold requested a review from XuPeng-SH as a code owner July 22, 2026 10:04
@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.

Blocking finding — fence the checkpoint intent generation as well (pkg/vm/engine/tae/db/testutil/funcs.go:323). The predicate still re-reads the current GetICKPIntentOnlyForTest() through latestCheckpointFinished. Concrete sequence: the waiter captures T; the checkpoint covering T completes so GetCheckpointed() >= T; WAL T+1 arrives; softScheduleCheckpoint installs a new ST_Pending intent with UpdateICKPIntent(..., true, false) while its dirty data is not yet flushed. checkpointTargetReached is then true, but latestCheckpointFinished is false, so this waiter still chases post-fence work and can time out after 10 seconds even though T is durable. The existing Test_RunnerStore3 state sequence already demonstrates finished intent -> nil -> newer pending intent. The added test only exercises the numeric helper and cannot catch this path. Please bind the lifecycle check to the checkpoint/intent generation that covered T (or another target-scoped completion signal), and add a deterministic regression with a newer pending intent installed after T completes.

@LeftHandCold
LeftHandCold force-pushed the fix/issue-26031-checkpoint-wait-fence branch from 15d86e8 to dc9a2ab Compare July 22, 2026 11:21
@LeftHandCold LeftHandCold changed the title test(tae): fence checkpoint wait at captured LSN test(tae): force scoped checkpoint before GC replay Jul 22, 2026

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

Deep-reviewed exact head 879e64bf2a962d8b0cfd983cd6d79e8964203a62. No blocking issues remain.

The previous generation-fencing finding is resolved: after all append workers finish, the test captures a target TS and calls ForceCheckpoint; ForceFlush is bounded by the caller context, and ForceICKP waits on the concrete intent returned for that target, then verifies the finished incremental checkpoint covers the target. It does not re-read or chase a later live intent generation. Success and rollback paths both close the shared intent completion channel.

Verified locally: TestAppendAndGC2 20x, TestAppendAndGC|TestAppendAndGC2 under race 3x, the full db/test and checkpoint packages, go vet, formatting, and diff/delivery checks. Merge after the in-progress CI finishes green.

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

mergify Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-22 13:08 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-07-22 13:18 UTC · at 879e64bf2a962d8b0cfd983cd6d79e8964203a62

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

Reason

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

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 8111ea8 into matrixorigin:main Jul 22, 2026
2 of 4 checks passed
@mergify mergify Bot removed the queued label Jul 22, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#26031

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

`TestAppendAndGC2` used the generic global-quiescence waiter after its
append
workload. That contract is not satisfiable in this test: it sets
`CheckpointCfg.MinCount = 3`, so a post-fence tail of one WAL entry is
valid
background state and does not schedule another incremental checkpoint.
CI
observed target LSN 201 already covered by checkpointed LSN 203, while
current
LSN 204 remained pending.

The previous revision fenced only the numeric LSN but still sampled the
live
checkpoint intent. That mixed generations in both directions: a newer
pending
intent could extend the wait, while the nil interval between generations
could
let the waiter return before the newer ICKP started. The latter happened
in
`TestAppendAndGC`: the waiter returned and the following zero-pending
assertion observed 2 while the next ICKP was starting.

This revision leaves the shared waiter and checkpoint runner unchanged.
Once
all append workers finish, `TestAppendAndGC2` explicitly calls
`ForceCheckpoint` with `TxnMgr.Now()` under a 10-second context.
`ForceCheckpoint` waits on the checkpoint intent that covers that target
TS,
so the test gets a target-scoped completion signal without chasing or
sampling
a different generation. The change is test-only and does not affect
MatrixOne
runtime behavior.

Validation:

- `TestAppendAndGC|TestAppendAndGC2`: 20 iterations each
- the same two tests under `-race`: 3 iterations each
- full `./pkg/vm/engine/tae/db/test` package
- 16 representative shared-waiter callers, including checkpoint, GC,
PITR,
  ISCP, snapshot, and replay tests
- `go vet ./pkg/vm/engine/tae/db/test ./pkg/vm/engine/tae/db/testutil`
- `git diff --check`

Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#26031

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

`TestAppendAndGC2` used the generic global-quiescence waiter after its
append
workload. That contract is not satisfiable in this test: it sets
`CheckpointCfg.MinCount = 3`, so a post-fence tail of one WAL entry is
valid
background state and does not schedule another incremental checkpoint.
CI
observed target LSN 201 already covered by checkpointed LSN 203, while
current
LSN 204 remained pending.

The previous revision fenced only the numeric LSN but still sampled the
live
checkpoint intent. That mixed generations in both directions: a newer
pending
intent could extend the wait, while the nil interval between generations
could
let the waiter return before the newer ICKP started. The latter happened
in
`TestAppendAndGC`: the waiter returned and the following zero-pending
assertion observed 2 while the next ICKP was starting.

This revision leaves the shared waiter and checkpoint runner unchanged.
Once
all append workers finish, `TestAppendAndGC2` explicitly calls
`ForceCheckpoint` with `TxnMgr.Now()` under a 10-second context.
`ForceCheckpoint` waits on the checkpoint intent that covers that target
TS,
so the test gets a target-scoped completion signal without chasing or
sampling
a different generation. The change is test-only and does not affect
MatrixOne
runtime behavior.

Validation:

- `TestAppendAndGC|TestAppendAndGC2`: 20 iterations each
- the same two tests under `-race`: 3 iterations each
- full `./pkg/vm/engine/tae/db/test` package
- 16 representative shared-waiter callers, including checkpoint, GC,
PITR,
  ISCP, snapshot, and replay tests
- `go vet ./pkg/vm/engine/tae/db/test ./pkg/vm/engine/tae/db/testutil`
- `git diff --check`

Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

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

## Which issue(s) this PR fixes:

Fixes matrixorigin#26031

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

`TestAppendAndGC2` used the generic global-quiescence waiter after its
append
workload. That contract is not satisfiable in this test: it sets
`CheckpointCfg.MinCount = 3`, so a post-fence tail of one WAL entry is
valid
background state and does not schedule another incremental checkpoint.
CI
observed target LSN 201 already covered by checkpointed LSN 203, while
current
LSN 204 remained pending.

The previous revision fenced only the numeric LSN but still sampled the
live
checkpoint intent. That mixed generations in both directions: a newer
pending
intent could extend the wait, while the nil interval between generations
could
let the waiter return before the newer ICKP started. The latter happened
in
`TestAppendAndGC`: the waiter returned and the following zero-pending
assertion observed 2 while the next ICKP was starting.

This revision leaves the shared waiter and checkpoint runner unchanged.
Once
all append workers finish, `TestAppendAndGC2` explicitly calls
`ForceCheckpoint` with `TxnMgr.Now()` under a 10-second context.
`ForceCheckpoint` waits on the checkpoint intent that covers that target
TS,
so the test gets a target-scoped completion signal without chasing or
sampling
a different generation. The change is test-only and does not affect
MatrixOne
runtime behavior.

Validation:

- `TestAppendAndGC|TestAppendAndGC2`: 20 iterations each
- the same two tests under `-race`: 3 iterations each
- full `./pkg/vm/engine/tae/db/test` package
- 16 representative shared-waiter callers, including checkpoint, GC,
PITR,
  ISCP, snapshot, and replay tests
- `go vet ./pkg/vm/engine/tae/db/test ./pkg/vm/engine/tae/db/testutil`
- `git diff --check`

Co-authored-by: XuPeng-SH <[email protected]>

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 kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TestAppendAndGC2 checkpoint wait chases post-fence WAL LSNs

3 participants