Skip to content

test: stabilize embedded and ISCP race tests under CI load - #26409

Merged
XuPeng-SH merged 4 commits into
mainfrom
fix/iceberg-embedded-account-timeout-26107
Jul 29, 2026
Merged

XuPeng-SH merged 4 commits into
mainfrom
fix/iceberg-embedded-account-timeout-26107

Conversation

@XuPeng-SH

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

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes

Fixes #26107

What this PR does / why we need it

This PR fixes three timing-sensitive race-UT failures by closing their timeout and asynchronous-state contracts. Successful paths do not sleep, and correctness is asserted from observable state transitions.

Embedded Iceberg tenant setup

CREATE ACCOUNT IF NOT EXISTS initializes tenant catalog/system tables and is safe to retry. The old helper used one 10s context for both the active SQL request and the whole retry loop. Once an attempt consumed that deadline, the retry path had no remaining budget.

  • bound each SQL attempt independently;
  • give the complete create operation a separate 30s budget;
  • stop immediately when the outer context expires;
  • retry only connection/transient errors;
  • validate retry policy and cover attempt expiry, outer expiry, cancellation, connection errors, and definitive SQL errors without short timing assertions.

Object-count schema coverage

TestCalculateObjectCount started a complete Log/TN/CN cluster only to verify whether the frontend-generated SHOW ACCOUNTS SQL includes object_count. Under race load, that exposed unrelated Dragonboat/HAKeeper bootstrap timing.

The production decision and the SQL it controls now come from one helper. Focused tests validate and parse the actual generated SQL for:

  • sys tenant + metrics database + no LIKE (include object_count);
  • non-metrics database;
  • filtered sys queries;
  • non-system tenants, including preservation of the existing account-only filtering behavior.

The full embedded-cluster test is removed; existing frontend tests continue to cover the projection itself.

ISCP recovery test

The old test used Never(100ms) to infer that an asynchronous failure happened, then removed the fault and waited up to 10s per watermark. It never proved that the worker had reached the intended fault, so scheduler load could make the injection disappear before it was exercised. In the reported run, recovery also crossed the fixed assertion deadline shortly after the transaction committed.

Each injected phase now has an optional context-aware fault barrier:

  1. install the barrier and the executor fault;
  2. append the target transaction;
  3. wait until a worker is observably parked at that exact fault;
  4. assert the target watermark has not advanced;
  5. remove the main fault before releasing all parked workers;
  6. wait for all three watermarks under one 30s phase hang guard.

All fault points have exactly-once cleanup, including FailNow paths. Normal production execution is unchanged because the barrier exists only when a test installs its keyed fault point.

Failure evidence: https://github.com/matrixorigin/matrixone/actions/runs/30469746913/job/90636646900?pr=26161

Scope

The earlier comment-only optools/run_ut.sh change was removed. This PR does not change package scheduling or globally serialize unrelated tests.

Validation

  • CGo-configured go build for changed non-test packages
  • CGo-configured go vet for all owning packages
  • make err-check
  • bash -n optools/run_ut.sh
  • git diff --check
  • adaptive exact race tests:
    • TestISCPExecutor4: measured 5.32s, -race -count=5
    • six embedded account retry/deadline tests: each -race -count=100
    • TestBuildShowAccountsSQL: -race -count=100
  • complete owning-package race tests (-race -count=1), run serially:
    • pkg/frontend: 26.2s
    • pkg/embed: 116.7s
    • pkg/util/test: 1.1s
    • pkg/iscp: 1.2s
    • pkg/objectio: 2.1s
    • pkg/vm/engine/test: 171.9s

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

@matrix-meow matrix-meow added the size/XS Denotes a PR that changes [1, 9] lines label Jul 29, 2026
@matrix-meow matrix-meow added size/S Denotes a PR that changes [10,99] lines and removed size/XS Denotes a PR that changes [1, 9] lines labels Jul 29, 2026
@XuPeng-SH
XuPeng-SH force-pushed the fix/iceberg-embedded-account-timeout-26107 branch from a0874b7 to d10c665 Compare July 29, 2026 17:09
@XuPeng-SH
XuPeng-SH force-pushed the fix/iceberg-embedded-account-timeout-26107 branch from dc632e8 to 76b12be Compare July 29, 2026 18:41
@XuPeng-SH
XuPeng-SH merged commit bd2690f into main Jul 29, 2026
30 checks passed
@XuPeng-SH
XuPeng-SH deleted the fix/iceberg-embedded-account-timeout-26107 branch July 29, 2026 19:18
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#26409)

## What type of PR is this?

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

## Which issue(s) this PR fixes

Fixes matrixorigin#26107

## What this PR does / why we need it

This PR fixes three timing-sensitive race-UT failures by closing their
timeout and asynchronous-state contracts. Successful paths do not sleep,
and correctness is asserted from observable state transitions.

### Embedded Iceberg tenant setup

`CREATE ACCOUNT IF NOT EXISTS` initializes tenant catalog/system tables
and is safe to retry. The old helper used one 10s context for both the
active SQL request and the whole retry loop. Once an attempt consumed
that deadline, the retry path had no remaining budget.

- bound each SQL attempt independently;
- give the complete create operation a separate 30s budget;
- stop immediately when the outer context expires;
- retry only connection/transient errors;
- validate retry policy and cover attempt expiry, outer expiry,
cancellation, connection errors, and definitive SQL errors without short
timing assertions.

### Object-count schema coverage

`TestCalculateObjectCount` started a complete Log/TN/CN cluster only to
verify whether the frontend-generated `SHOW ACCOUNTS` SQL includes
`object_count`. Under race load, that exposed unrelated
Dragonboat/HAKeeper bootstrap timing.

The production decision and the SQL it controls now come from one
helper. Focused tests validate and parse the actual generated SQL for:

- sys tenant + metrics database + no `LIKE` (include `object_count`);
- non-metrics database;
- filtered sys queries;
- non-system tenants, including preservation of the existing
account-only filtering behavior.

The full embedded-cluster test is removed; existing frontend tests
continue to cover the projection itself.

### ISCP recovery test

The old test used `Never(100ms)` to infer that an asynchronous failure
happened, then removed the fault and waited up to 10s per watermark. It
never proved that the worker had reached the intended fault, so
scheduler load could make the injection disappear before it was
exercised. In the reported run, recovery also crossed the fixed
assertion deadline shortly after the transaction committed.

Each injected phase now has an optional context-aware fault barrier:

1. install the barrier and the executor fault;
2. append the target transaction;
3. wait until a worker is observably parked at that exact fault;
4. assert the target watermark has not advanced;
5. remove the main fault before releasing all parked workers;
6. wait for all three watermarks under one 30s phase hang guard.

All fault points have exactly-once cleanup, including `FailNow` paths.
Normal production execution is unchanged because the barrier exists only
when a test installs its keyed fault point.

Failure evidence:
https://github.com/matrixorigin/matrixone/actions/runs/30469746913/job/90636646900?pr=26161

## Scope

The earlier comment-only `optools/run_ut.sh` change was removed. This PR
does not change package scheduling or globally serialize unrelated
tests.

## Validation

- CGo-configured `go build` for changed non-test packages
- CGo-configured `go vet` for all owning packages
- `make err-check`
- `bash -n optools/run_ut.sh`
- `git diff --check`
- adaptive exact race tests:
  - `TestISCPExecutor4`: measured 5.32s, `-race -count=5`
  - six embedded account retry/deadline tests: each `-race -count=100`
  - `TestBuildShowAccountsSQL`: `-race -count=100`
- complete owning-package race tests (`-race -count=1`), run serially:
  - `pkg/frontend`: 26.2s
  - `pkg/embed`: 116.7s
  - `pkg/util/test`: 1.1s
  - `pkg/iscp`: 1.2s
  - `pkg/objectio`: 2.1s
  - `pkg/vm/engine/test`: 171.9s
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#26409)

## What type of PR is this?

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

## Which issue(s) this PR fixes

Fixes matrixorigin#26107

## What this PR does / why we need it

This PR fixes three timing-sensitive race-UT failures by closing their
timeout and asynchronous-state contracts. Successful paths do not sleep,
and correctness is asserted from observable state transitions.

### Embedded Iceberg tenant setup

`CREATE ACCOUNT IF NOT EXISTS` initializes tenant catalog/system tables
and is safe to retry. The old helper used one 10s context for both the
active SQL request and the whole retry loop. Once an attempt consumed
that deadline, the retry path had no remaining budget.

- bound each SQL attempt independently;
- give the complete create operation a separate 30s budget;
- stop immediately when the outer context expires;
- retry only connection/transient errors;
- validate retry policy and cover attempt expiry, outer expiry,
cancellation, connection errors, and definitive SQL errors without short
timing assertions.

### Object-count schema coverage

`TestCalculateObjectCount` started a complete Log/TN/CN cluster only to
verify whether the frontend-generated `SHOW ACCOUNTS` SQL includes
`object_count`. Under race load, that exposed unrelated
Dragonboat/HAKeeper bootstrap timing.

The production decision and the SQL it controls now come from one
helper. Focused tests validate and parse the actual generated SQL for:

- sys tenant + metrics database + no `LIKE` (include `object_count`);
- non-metrics database;
- filtered sys queries;
- non-system tenants, including preservation of the existing
account-only filtering behavior.

The full embedded-cluster test is removed; existing frontend tests
continue to cover the projection itself.

### ISCP recovery test

The old test used `Never(100ms)` to infer that an asynchronous failure
happened, then removed the fault and waited up to 10s per watermark. It
never proved that the worker had reached the intended fault, so
scheduler load could make the injection disappear before it was
exercised. In the reported run, recovery also crossed the fixed
assertion deadline shortly after the transaction committed.

Each injected phase now has an optional context-aware fault barrier:

1. install the barrier and the executor fault;
2. append the target transaction;
3. wait until a worker is observably parked at that exact fault;
4. assert the target watermark has not advanced;
5. remove the main fault before releasing all parked workers;
6. wait for all three watermarks under one 30s phase hang guard.

All fault points have exactly-once cleanup, including `FailNow` paths.
Normal production execution is unchanged because the barrier exists only
when a test installs its keyed fault point.

Failure evidence:
https://github.com/matrixorigin/matrixone/actions/runs/30469746913/job/90636646900?pr=26161

## Scope

The earlier comment-only `optools/run_ut.sh` change was removed. This PR
does not change package scheduling or globally serialize unrelated
tests.

## Validation

- CGo-configured `go build` for changed non-test packages
- CGo-configured `go vet` for all owning packages
- `make err-check`
- `bash -n optools/run_ut.sh`
- `git diff --check`
- adaptive exact race tests:
  - `TestISCPExecutor4`: measured 5.32s, `-race -count=5`
  - six embedded account retry/deadline tests: each `-race -count=100`
  - `TestBuildShowAccountsSQL`: `-race -count=100`
- complete owning-package race tests (`-race -count=1`), run serially:
  - `pkg/frontend`: 26.2s
  - `pkg/embed`: 116.7s
  - `pkg/util/test`: 1.1s
  - `pkg/iscp`: 1.2s
  - `pkg/objectio`: 2.1s
  - `pkg/vm/engine/test`: 171.9s
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#26409)

## What type of PR is this?

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

## Which issue(s) this PR fixes

Fixes matrixorigin#26107

## What this PR does / why we need it

This PR fixes three timing-sensitive race-UT failures by closing their
timeout and asynchronous-state contracts. Successful paths do not sleep,
and correctness is asserted from observable state transitions.

### Embedded Iceberg tenant setup

`CREATE ACCOUNT IF NOT EXISTS` initializes tenant catalog/system tables
and is safe to retry. The old helper used one 10s context for both the
active SQL request and the whole retry loop. Once an attempt consumed
that deadline, the retry path had no remaining budget.

- bound each SQL attempt independently;
- give the complete create operation a separate 30s budget;
- stop immediately when the outer context expires;
- retry only connection/transient errors;
- validate retry policy and cover attempt expiry, outer expiry,
cancellation, connection errors, and definitive SQL errors without short
timing assertions.

### Object-count schema coverage

`TestCalculateObjectCount` started a complete Log/TN/CN cluster only to
verify whether the frontend-generated `SHOW ACCOUNTS` SQL includes
`object_count`. Under race load, that exposed unrelated
Dragonboat/HAKeeper bootstrap timing.

The production decision and the SQL it controls now come from one
helper. Focused tests validate and parse the actual generated SQL for:

- sys tenant + metrics database + no `LIKE` (include `object_count`);
- non-metrics database;
- filtered sys queries;
- non-system tenants, including preservation of the existing
account-only filtering behavior.

The full embedded-cluster test is removed; existing frontend tests
continue to cover the projection itself.

### ISCP recovery test

The old test used `Never(100ms)` to infer that an asynchronous failure
happened, then removed the fault and waited up to 10s per watermark. It
never proved that the worker had reached the intended fault, so
scheduler load could make the injection disappear before it was
exercised. In the reported run, recovery also crossed the fixed
assertion deadline shortly after the transaction committed.

Each injected phase now has an optional context-aware fault barrier:

1. install the barrier and the executor fault;
2. append the target transaction;
3. wait until a worker is observably parked at that exact fault;
4. assert the target watermark has not advanced;
5. remove the main fault before releasing all parked workers;
6. wait for all three watermarks under one 30s phase hang guard.

All fault points have exactly-once cleanup, including `FailNow` paths.
Normal production execution is unchanged because the barrier exists only
when a test installs its keyed fault point.

Failure evidence:
https://github.com/matrixorigin/matrixone/actions/runs/30469746913/job/90636646900?pr=26161

## Scope

The earlier comment-only `optools/run_ut.sh` change was removed. This PR
does not change package scheduling or globally serialize unrelated
tests.

## Validation

- CGo-configured `go build` for changed non-test packages
- CGo-configured `go vet` for all owning packages
- `make err-check`
- `bash -n optools/run_ut.sh`
- `git diff --check`
- adaptive exact race tests:
  - `TestISCPExecutor4`: measured 5.32s, `-race -count=5`
  - six embedded account retry/deadline tests: each `-race -count=100`
  - `TestBuildShowAccountsSQL`: `-race -count=100`
- complete owning-package race tests (`-race -count=1`), run serially:
  - `pkg/frontend`: 26.2s
  - `pkg/embed`: 116.7s
  - `pkg/util/test`: 1.1s
  - `pkg/iscp`: 1.2s
  - `pkg/objectio`: 2.1s
  - `pkg/vm/engine/test`: 171.9s

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/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Embedded Iceberg credential UT loses logservice connection during CREATE ACCOUNT

2 participants