Skip to content

perf(test): accelerate race batches and fix checkpoint and fixture ownership - #30426

Merged
XuPeng-SH merged 13 commits into
mainfrom
codex/ut-race-next-20261016b
Oct 16, 2026
Merged

XuPeng-SH merged 13 commits into
mainfrom
codex/ut-race-next-20261016b

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 16, 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 #30412
Fixes #30420
Fixes #30422
Fixes #30425
Fixes #30357
Fixes #30336
Fixes #30323
Fixes #30229

Related: #29249, #30372, #30322, #30424.

What this PR does / why we need it:

Reduce race-test wall time without removing behavioral coverage

  • Give the existing single-runner UT entrypoint eight tasks, enabling its existing four-worker issues batching. Use four embedded-cluster slots for the audited eight-task batches; retain smaller-host limits and exclusive execution for unclassified/heavy owners. Child processes retain a two-CPU Go budget. No runner split, skipped tests, weakened assertions or timeout inflation.
  • Replace an oversized RPC success fixture (100 objects × 50 blocks) with three objects × three blocks, still crossing the two-block object boundary. Check committed object/block identities and complete row multisets instead of relying only on counts. Remove the single-caller setup wrapper while retaining restart-aware cleanup.
  • Scope scenario deadlines, configuration restoration, metadata publication and merge-promotion observations to their actual owners. Independent scenarios no longer consume a shared setup/cleanup deadline. Release the heartbeat registration barrier from the signal sender, avoiding a trap/read wait cycle.
  • Archive previous UT failure output beside its raw report before analyzing the next run. Old failures cannot mark a successful new run red; current Go, analyzer and generated-failure statuses still fail the gate.

Fix production failures at existing responsibility boundaries

  • HAKeeper: recognize wrapped native ECONNRESET in the existing retry classifier. Reuse existing retry bounds, cancellation and client replacement; do not introduce another retry mechanism.
  • Checkpoint writing: use ObjectPersisted to exclude unpersisted appendable carriers. Their later payload belongs to WAL replay. Preserve legacy forced-persisted objects even with empty extents, and preserve persisted data/tombstone create/drop events. The real-engine regression checkpoints before the first append, commits into the same carrier, restarts and checks recovered rows.
  • Checkpoint predecessor resolution: prefer a finished, published global table-ID index at the same boundary over an incremental index that GC may already have removed. Preserve pending/running/legacy/different-boundary controls and existing history validation. No disk/wire format change or new GC retention state.
  • Backup tests retain their concurrent workload, copy/restore and data oracles. Fail at the first operation error and roll back only transactions still owned by the failing operation.

Measured performance and resource tradeoffs

Sequential matched runs on the same eight-CPU, 16-GiB/no-swap budget, two versus four embedded slots:

Owner Two slots Four slots
embed 183.276 s 134.425 s
dml 92.304 s 56.864 s
issues/isolated 102.034 s 75.566 s
sqlintegration 132.064 s 75.574 s
Total of these measured owners 509.679 s 342.429 s

This saves 167.250 seconds (~33%) for those owners, not a measured whole-CI reduction. Peak PSS for the four-slot owners was 4.59–7.24 GiB, with no OOM; aggregate CPU increased roughly 15–20%. Existing two-to-four-worker issues batching is now reachable from the real workflow configuration. Whole-CI savings require the new CI result and must not be inferred by summing overlapping package times.

The original backup regression dropped from approximately 61 seconds to 1.37 seconds when the deleted-index retry disappeared. Temporary storage also changed between those observations, so this is not presented as a matched throughput benchmark or added to the CI estimate.

Validation

  • Incremental gofmt, vet, molint and golangci-lint passed for all ten changed Go packages; final SQL deadline and report-generation edits also passed their package-local static checks. CI scope tests: 18 passed.
  • Related full owning-package race tests passed: optools, logservice, checkpoint, database replay, backup, logtail, merge and RPC. Final public SQL consumers passed for prepared specialized domains, metadata publication/session isolation and auto-ID restart/cache-disabled behavior.
  • The actual Make issues shard completed all eight test batches successfully, with 184 root tests and no failing test events. Its initial Make result was nonzero because stale failure files remained from an earlier run. After fixing report ownership, replaying the same complete raw report through the actual analyzer succeeded. Peak cgroup memory was 6.54 GiB, with zero OOM events and no swap.
  • Deterministic before/after regressions demonstrate both checkpoint defects and the stale-report defect. The carrier restart regression also passed 54 race repetitions; predecessor controls passed 100 race repetitions. Native reset, heartbeat barrier and cleanup-failure controls retain their boundedness and negative oracles.
  • Eight production-owner coverage comparison plus existing deterministic cache/vector-pool controls retained every previously covered block. This is a scoped block-retention check, not a claim that fresh whole-repository CI coverage is complete.
  • Rebased onto main 7387b96; all twelve patches are unchanged according to range-diff. No separate distributed BVT run is claimed; real SQL, restart and backup/restore consumers were exercised locally. New-head CI remains pending publication.

Scope and remaining incidents

This PR does not assert that every historical assigned UT incident is solved. #30309 and #30209 did not reproduce under their focused controls, and the cause of the peer reset in #30372 is not established by fixing its retry classification. The older per-resource cleanup correction for #30322 already exists on main; this PR additionally fixes shared execution-deadline ownership. External Maven resolution (#30333) and authorization work (#30273) are outside this change. These issues are not closed by this PR.

Related initial-admission incident #30424

The native-reset retry correction also applies to the transport failures observed in #30424, which fails during initial CN admission, and #30372, which fails final withdrawal. This is a recovery improvement, not a claim that either incident is fully fixed.

A local diagnostic probe pauses real HAKeeper Raft stepping without injecting an RPC error or closing a socket. An expired heartbeat response makes the synchronous server handler fail and close its connection; a concurrent request whose own deadline remains valid receives native ECONNRESET. This occurred in 14/14 race runs, and heartbeats recovered after releasing the Raft barrier. With only the added ECONNRESET classification removed, the managed client returns the reset; with this PR it reconnects/retries and succeeds after Raft resumes. The MORPC server source is identical on both reported CI heads and this PR.

The original AutoID restart test passed locally under a two-CPU, 8-GiB/no-swap limit. The probe establishes a timeout-to-reset propagation mechanism; it does not reproduce or identify the original cause of the CI Raft stalls. If the stall lasts beyond the startup/withdrawal deadline, retrying cannot restore progress. Keep #30424 and #30372 open for that investigation; neither is a closing reference in this PR.

Avoid sharing a one-second deadline across the committed resume barrier and subsequent state queries. Preserve the separate controlled cancellation test.

Fixes #30336.
Remove redundant NTILE table teardown from the shared session, assert bounded database cleanup, isolate schema-commit scenario sessions, and observe metadata readiness against query termination and the test lifetime. Join cancelled queries using an independent cleanup context.

Fixes #30357. Fixes #30229.
…nder

A Bash read can defer a trapped TERM until input arrives. Publishing that input from the same handler creates a cycle. Let the signal sender release the controlled read, check stop intent before PID publication, and retain exact child termination and reaping assertions for TERM and INT.

Fixes #30323.
Recognize wrapped syscall.ECONNRESET in the existing managed-client retry classifier. Preserve caller deadlines and generation ownership. Extend existing replacement, terminal-error and cancellation oracles; run retry deadline cases on the standard synctest clock.

Related to #30372.
… own deadlines

Fixes #30422. Preserve the existing per-operation limits and all gate, cleanup, and result assertions; avoid consuming a later scenario budget in earlier subtests.
Fixes #30412. Reuse ObjectPersisted to prevent a checkpoint from publishing an empty carrier as a durable file. Preserve legacy forced-persisted nodes and persisted create/drop records. Add a deterministic checkpoint-before-first-append restart regression and retain bounded, fail-fast backup test ownership.
Fixes #30425. The incremental metadata can outlive its GC-deleted index; use the finished same-boundary global index already validated by checkpoint publication. Preserve pending-intent exclusion, legacy recovery and streaming fail-closed continuity checks.
@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 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 7e102fe257df3ab206a742145c9e76eb127801d2

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 7e102fe257df3ab206a742145c9e76eb127801d2

Assessment: request_changes

Reviewed the complete 22-file delta and surrounding owners/callers. The checkpoint, retry, fixture and cleanup changes coherently reuse existing responsibilities, and functional/race validation passed. One material validation requirement remains: the concurrency increase also affects an ordinary embedded-test wave absent from the supplied performance evidence.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

  • P2 Makefile:616: Default Linux CI now requests eight tasks, setting UT_EMBEDDED_PACKAGE_PARALLEL=4. The ordinary embedded wave also consumes this value for both Go package parallelism and cluster admission.
    Impact: Validation requirement: this doubles concurrency for additional real cluster owners without evidence establishing their combined resource behavior on the eight-CPU, 16-GiB runner. Supply matched two-versus-four-worker ordinary-wave runs with terminal receipts, selected scope, wall/CPU measurements, aggregate peak memory and OOM telemetry, or retain its previous two-worker limit while enabling four for the measured batches. No OOM or slowdown is asserted.
    Evidence: optools/run_ut.sh:2560–2574 applies the shared setting to ordinary_scope. Executed dependency discovery identified arrowload, partition, shard, sqlintegration/multicn, testutils and upgrade in that wave; their allowlisting avoids serial fallback. The PR's measurements cover only embed, dml, issues/isolated and sqlintegration, plus the separate issues shard. TestEmbeddedAuditedBatchScopeAndFailure/four-workers-ordinary uses mocked example packages and verifies dispatch only. See embedded-owner-inventory.log and its receipt in validation-index.json.

Validation:

  • Reconciled command, frozen-source fingerprint, exit and retained-log evidence in /home/xupeng/.local/state/mo-bot/jobs/2eaa38877fa3ec083b46f90e/attempt-1/validation-index.json. The final audit passed; source remained unchanged.

  • Private-/tmp and loopback preflight passed. Native prerequisites were built through repository Make rules; source, exported inputs and native artifact hashes were verified.

  • Passed 18 CI scope tests, shell syntax, diff/format checks and go vet for all ten changed Go packages.

  • Passed full race suites for optools, logservice, logtail, checkpoint, backup, merge and db. Full RPC initially encountered two read-only-working-directory failures; the unchanged race binary subsequently passed through test-exec from the diagnostic directory.

  • Passed focused production regressions, four checkpoint/replay consumer regressions and five changed public SQL roots. Adaptive race repetitions passed for retry, checkpoint, backup, RPC, lifecycle and harness paths.

  • Both checkpoint regressions failed as expected with their respective base functions overlaid and passed on the candidate. These are function-level before/after controls, not full-base suite runs.

Limitations:

  • No constrained ordinary-wave benchmark, complete CI run or separate distributed BVT was performed. Public SQL validation covered changed roots rather than every test in those packages.

  • local_validation was empty; linked issue bodies and raw author performance/coverage artifacts were not supplied. The reported approximately 33% wall-time reduction and 15–20% CPU increase concern four batched owners and were not independently verified.

  • The initial native-setup failure receipt remains, but its log was superseded during recovery; it is excluded from product-validation claims.

@XuPeng-SH
XuPeng-SH merged commit 47b9690 into main Oct 16, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/ut-race-next-20261016b branch October 16, 2026 16:54
XuPeng-SH added a commit that referenced this pull request Nov 17, 2026
Backport wrapped ECONNRESET recovery from main commit 47b9690 (#30426).
Reuse existing client replacement, context and retry waits. Extend the
existing allocation fixtures for reset, deadline and cancellation controls.

Related to #30420.
XuPeng-SH added a commit that referenced this pull request Nov 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:

Related to #30420 (native-reset fix on main: #30426) and #28452 (related
HAKeeper transport recovery).

Related: #32825 and its [failed UT
run](https://github.com/matrixorigin/matrixone/actions/runs/44011324458/job/133798814581).

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

A native connection reset can escape HAKeeper recovery during ID
allocation, making an operation such as CREATE DATABASE fail. Recognize
wrapped `ECONNRESET` and the relevant typed backend connection errors in
the existing retry path; preserve the MORPC backend-creation timeout
sentinel as a non-retryable result.

Keep client ownership in the managed client: closing it now ends
admission and wakes retry waiters, and a late failure only resets the
client generation that actually failed. This prevents a retry from
recreating a client after `Close` and prevents a stale failure from
closing its replacement. Honor cancellation before issuing cached IDs or
publishing a newly constructed client, and pass the caller context
through reverse-proxy discovery while retaining discovery's own RPC
options.

For callers with an explicit MORPC backend-wait deadline, newly
retryable transport failures return their original error after the
current failed attempt rather than starting another HAKeeper-level dial.
Existing EOF/NoHAKeeper retry behavior is preserved. An already-running
synchronous dial or client cleanup can still overrun a caller or
backend-wait deadline; this PR does not claim a hard end-to-end timeout.
Lost allocation responses can still produce ID gaps, and the initiating
server-side reset in the reported CI run is not established.

Validation on 10.222.1.57, Linux/amd64, Go 1.26.4 and matching CPU CGo
libraries:

- Reproduced retry after `Close` and late-generation failure; regression
coverage exercises terminal close, concurrent callers, cleanup errors,
context cancellation and recovery, including a real MORPC
backend-creation timeout.
- `pkg/logservice` in normal and race modes (`-short -tags
matrixone_test -count=1`): 307 passing root tests / 463 named passes,
zero failures and one existing skip in each mode. Each of 17 changed/new
roots also passed 100 race repetitions.
- Existing three-CN `TestTableFeatures` passed with race and its
original topology and assertions; existing MORPC backend-wait and
HAKeeper ID-state-machine controls passed under race.
- Formatting/diff checks, vet, pinned molint and incremental
golangci-lint passed for the owner and direct constructor/consumer
closure (nine packages).

The logservice suites used isolated user/network namespaces after a
pre-existing host listener prevented an unrelated Gossip test from
binding its port; no test assertion or port was changed. Cached ID
admission adds a context/close check under the existing lock; a
single-CPU microbenchmark measured roughly 2 ns/op extra and zero
allocations, not an end-to-end throughput measurement.

CI for the updated head is pending.

This branch had an error being deployed

1 failed deployment
ci — ea3d8366 Deployed Oct 16, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment