Skip to content

test: stabilize asynchronous cleanup waits - #26256

Merged
XuPeng-SH merged 2 commits into
mainfrom
agent/fix-flaky-test-deadlines
Jul 27, 2026
Merged

XuPeng-SH merged 2 commits into
mainfrom
agent/fix-flaky-test-deadlines

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Fixes #26254
Fixes #26255
Fixes #26253

What this PR does / why we need it:

Two unrelated asynchronous subsystems were made flaky by test-only timing assumptions under the parallel Ubuntu/x86 UT workload.

Root cause

  • TAE checkpoint tests wrapped real flush/checkpoint I/O in 5, 10, or 20 second deadlines. A single storage writer.Sync can legitimately exceed 20 seconds under parallel CI, so TestSnapshotGC could cancel ForceFlush before the asynchronous work completed.
  • The user-level-lock test service latched blockUnlock=true when Unlock entered. Clearing the flag did not release calls already in flight; all four detached-cleanup workers remained occupied until their one-second contexts expired. A saturated 1,024-entry test queue could therefore miss its three-second recovery assertion.

Changes

  • Add a shared one-minute checkpoint/flush timeout for storage-backed TAE tests and apply it to the short checkpoint helpers and nearby direct call sites.
  • Make the user-level-lock test double observe recovery while an unlock is in flight.
  • Add a deterministic regression proving an already-blocked mock unlock resumes promptly.

Production checkpoint and user-lock behavior is unchanged.

Validation

  • TestUserLevelLockCleanupTestServiceUnblocksInFlightUnlock|TestDetachedUserLevelLockCleanupQueueIsBoundedAndDeduped: -race -count=20
  • TestSnapshotGC|TestAppendAndGC2|TestCkpLeak|TestReplay2: -count=5
  • Same TAE set: -race -count=1
  • Full pkg/sql/plan/function, pkg/vm/engine/tae/db/test, and pkg/vm/engine/tae/db/testutil tests
  • go build for affected production/test-support packages
  • go vet for affected test packages

@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 merged commit a55820b into main Jul 27, 2026
5 of 8 checks passed
@XuPeng-SH
XuPeng-SH deleted the agent/fix-flaky-test-deadlines branch July 27, 2026 13:15
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG
- [x] Test and CI

## Which issue(s) this PR fixes:

Fixes matrixorigin#26254
Fixes matrixorigin#26255

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

Two unrelated asynchronous subsystems were made flaky by test-only
timing assumptions under the parallel Ubuntu/x86 UT workload.

### Root cause

- TAE checkpoint tests wrapped real flush/checkpoint I/O in 5, 10, or 20
second deadlines. A single storage `writer.Sync` can legitimately exceed
20 seconds under parallel CI, so `TestSnapshotGC` could cancel
`ForceFlush` before the asynchronous work completed.
- The user-level-lock test service latched `blockUnlock=true` when
`Unlock` entered. Clearing the flag did not release calls already in
flight; all four detached-cleanup workers remained occupied until their
one-second contexts expired. A saturated 1,024-entry test queue could
therefore miss its three-second recovery assertion.

### Changes

- Add a shared one-minute checkpoint/flush timeout for storage-backed
TAE tests and apply it to the short checkpoint helpers and nearby direct
call sites.
- Make the user-level-lock test double observe recovery while an unlock
is in flight.
- Add a deterministic regression proving an already-blocked mock unlock
resumes promptly.

Production checkpoint and user-lock behavior is unchanged.

## Validation

-
`TestUserLevelLockCleanupTestServiceUnblocksInFlightUnlock|TestDetachedUserLevelLockCleanupQueueIsBoundedAndDeduped`:
`-race -count=20`
- `TestSnapshotGC|TestAppendAndGC2|TestCkpLeak|TestReplay2`: `-count=5`
- Same TAE set: `-race -count=1`
- Full `pkg/sql/plan/function`, `pkg/vm/engine/tae/db/test`, and
`pkg/vm/engine/tae/db/testutil` tests
- `go build` for affected production/test-support packages
- `go vet` for affected test packages
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG
- [x] Test and CI

## Which issue(s) this PR fixes:

Fixes matrixorigin#26254
Fixes matrixorigin#26255

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

Two unrelated asynchronous subsystems were made flaky by test-only
timing assumptions under the parallel Ubuntu/x86 UT workload.

### Root cause

- TAE checkpoint tests wrapped real flush/checkpoint I/O in 5, 10, or 20
second deadlines. A single storage `writer.Sync` can legitimately exceed
20 seconds under parallel CI, so `TestSnapshotGC` could cancel
`ForceFlush` before the asynchronous work completed.
- The user-level-lock test service latched `blockUnlock=true` when
`Unlock` entered. Clearing the flag did not release calls already in
flight; all four detached-cleanup workers remained occupied until their
one-second contexts expired. A saturated 1,024-entry test queue could
therefore miss its three-second recovery assertion.

### Changes

- Add a shared one-minute checkpoint/flush timeout for storage-backed
TAE tests and apply it to the short checkpoint helpers and nearby direct
call sites.
- Make the user-level-lock test double observe recovery while an unlock
is in flight.
- Add a deterministic regression proving an already-blocked mock unlock
resumes promptly.

Production checkpoint and user-lock behavior is unchanged.

## Validation

-
`TestUserLevelLockCleanupTestServiceUnblocksInFlightUnlock|TestDetachedUserLevelLockCleanupQueueIsBoundedAndDeduped`:
`-race -count=20`
- `TestSnapshotGC|TestAppendAndGC2|TestCkpLeak|TestReplay2`: `-count=5`
- Same TAE set: `-race -count=1`
- Full `pkg/sql/plan/function`, `pkg/vm/engine/tae/db/test`, and
`pkg/vm/engine/tae/db/testutil` tests
- `go build` for affected production/test-support packages
- `go vet` for affected test packages
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG
- [x] Test and CI

## Which issue(s) this PR fixes:

Fixes matrixorigin#26254
Fixes matrixorigin#26255

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

Two unrelated asynchronous subsystems were made flaky by test-only
timing assumptions under the parallel Ubuntu/x86 UT workload.

### Root cause

- TAE checkpoint tests wrapped real flush/checkpoint I/O in 5, 10, or 20
second deadlines. A single storage `writer.Sync` can legitimately exceed
20 seconds under parallel CI, so `TestSnapshotGC` could cancel
`ForceFlush` before the asynchronous work completed.
- The user-level-lock test service latched `blockUnlock=true` when
`Unlock` entered. Clearing the flag did not release calls already in
flight; all four detached-cleanup workers remained occupied until their
one-second contexts expired. A saturated 1,024-entry test queue could
therefore miss its three-second recovery assertion.

### Changes

- Add a shared one-minute checkpoint/flush timeout for storage-backed
TAE tests and apply it to the short checkpoint helpers and nearby direct
call sites.
- Make the user-level-lock test double observe recovery while an unlock
is in flight.
- Add a deterministic regression proving an already-blocked mock unlock
resumes promptly.

Production checkpoint and user-lock behavior is unchanged.

## Validation

-
`TestUserLevelLockCleanupTestServiceUnblocksInFlightUnlock|TestDetachedUserLevelLockCleanupQueueIsBoundedAndDeduped`:
`-race -count=20`
- `TestSnapshotGC|TestAppendAndGC2|TestCkpLeak|TestReplay2`: `-count=5`
- Same TAE set: `-race -count=1`
- Full `pkg/sql/plan/function`, `pkg/vm/engine/tae/db/test`, and
`pkg/vm/engine/tae/db/testutil` tests
- `go build` for affected production/test-support packages
- `go vet` for affected test packages

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

Projects

None yet

2 participants