Skip to content

test: restore engine coverage and reduce CI I/O on 4.2-dev - #32721

Closed
XuPeng-SH wants to merge 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:xp/42-ut-coverage-restore
Closed

XuPeng-SH wants to merge 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:xp/42-ut-coverage-restore

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 13, 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:

Related to #32718.

What this PR does / why we need it:

#32700 reduced engine-test I/O but also replaced the original large CN-object scenario and the independently selectable 150-row varchar test. Restore those paths and remove redundant test work and output:

  • Retain three independent 16,384-row CN objects, each with two full blocks, and three independent two-row appendable objects that are actually flushed to non-CN objects. Pair one large and one small table before each checkpoint: three checkpoints instead of six. Assert each pair's changed IDs, checkpoint bounds, and final 0/0/MaxTs responses; retain the named small-child selector and parent fallback.
  • Restore the independently selectable 150-row varchar insert/commit/read test and keep the original two-row Test_BasicS3InsertDelete/varchar_insert_only_commit selector. Explicitly enable workspace accounting checks for test engines rather than depending on a preceding global DEBUG setting.
  • Scope and restore DEBUG configuration. Nine publication cases still enable DEBUG guards, encode fields, pass DEBUG events to the existing trace reporter, preserve INFO/WARN/ERROR, and run the same assertions, but omit DEBUG console output even on failure. A caller that already enabled DEBUG keeps full DEBUG output. The reduced failure diagnostics are deliberate relative to the original PR head and the historical leaked-global-DEBUG execution.
  • Replace an accidental 1,000 retries of a permanently missing table with two integration-path subscription error cycles using the fixture's mocked RPC and per-cycle error/state assertions; retain 1,000 inexpensive state-cleanup iterations. This does not preserve the old 1,000 repeated mock-RPC attempts and their scheduling pressure. Selected transient RPC/stream errors retry with 25-second per-attempt contexts under the original five-minute parent and a 1,000-attempt cap. The fixture's mock stream Send can block without observing context, so these contexts are not a hard deadline for a blocked send.
  • Release three test-owned change-handle batches after engine teardown without changing their data, assertions, or object boundaries. In isolated and fixture-level measurements their pool allocations were 7,274,496, 7,274,496 and 1,859,584 bytes, all returned by Close; this is allocator accounting, not a claim about equivalent RSS or disk savings.

Local I/O comparison

Using precompiled race binaries on the same host with Go 1.26.4, -short, and the same selectors, the nine publication cases produced these two-run samples:

Measurement Original PR head 43c1a174 This change
Test JSON bytes 39,092,609 / 38,987,785 2,591,770 / 2,611,869
Process-accounted write bytes 46,039,040 / 46,190,592 9,572,352 / 9,666,560

All nine cases passed in every sample. The before and after pairs were run consecutively but were not a single strict ABBA sequence. In individual full-engine-package samples:

Measurement Clean merge base 1d90e519 Original PR head 43c1a174 Final change
Test JSON bytes 15,775,219 53,426,399 14,242,108
Process-accounted write bytes 206,905,344 245,542,912 205,922,304
Wall seconds 190.733 190.659 185.145

The final package retains all baseline top-level names and outcomes and adds the restored varchar case and subscription retry test. These are single samples on a shared host; process-accounted writes include the report and are not physical-device or whole-CI measurements, and the wall-time difference is not attributed. A separate per-test process-I/O probe attributed about 105 MB to the retained real-disk 100 MiB TestGetObjectChunk; background writes can cross test boundaries, and replacing that storage path with an in-memory approximation would change its integration coverage.

Validation

  • -race -short -tags matrixone_test: full engine package 169 passed / 3 existing skips, disttae 410 passed, logutil 42 passed. Ten selected engine cases also passed without race. Original and restored named selectors were run explicitly. Each of the three batch-cleanup tests was individually repeated under race (16 / 15 / 50 iterations); logger cleanup/reentry and subscription/checkpoint cases were also individually repeated.
  • External QA controls verified that changed-list results come from checkpoints with dirty-tree results suppressed, reject missing checkpoints/flushes and malformed requests, and test unexpected subscription results. A separate test drives the real subscription state machine through a short deadline and an artificial missing-table response; it does not simulate a delayed mock-RPC response. Logger-scope guards covered 12 actual cases; injected failures retain INFO/WARN/ERROR, and a caller's DEBUG remains visible. Batch failure injections before use and after commit, a skip-close negative control, and poison-on-free controls verified engine-close-before-batch-close and pool accounting. The fake storage rollback is a no-op, so the rollback controls do not establish remote rollback.
  • Atomic coverage comparison for 11 selected cases and five unchanged engine packages used 14,677 matching blocks: the original PR head hit 4,145, the final change hit 4,155, and none hit only by the original head were lost. This is aggregate sampled block coverage, not per-case, branch, stress, or whole-repository equivalence.
  • Go 1.26.4 gofmt, git diff --check, 13 changed-file license checks, go vet, and diff-scoped golangci-lint passed for the changed packages and direct fixture consumer. The pinned repository molint also reports an existing checkrecover finding at unchanged pkg/frontend/routine.go:357; the same finding was reproduced with the same analyzer on clean 4.2-dev, with no new findings observed.

The publication tests already have a checkpoint worker that is signalled but not joined. This change does not add that worker or close a sink it may still use; late worker logging and its existing failure-path lifetime remain possible.

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

@mergify

mergify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is closed, so it cannot be queued. Reopen it to get the box back.

@XuPeng-SH

XuPeng-SH commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 43c1a1745f3e80ff2288be127d23c848844de92f

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: 43c1a1745f3e80ff2288be127d23c848844de92f

Assessment: approve

The restored large CN-object, small appendable-flush and independent varchar cases preserve distinct coverage. Scoped logger ownership reuses the existing logger configuration, while an engine-local test option reuses workspace accounting without depending on DEBUG state. The added mechanisms are proportionate; no actionable defect found.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Full logutil normal and race runs each passed 35 top-level tests with no skips: logutil-normal.stdout.log, logutil-race.stdout.log and matching receipts recorded in review-audit.json.

  • All nine exact logger stress selections passed: eight at N=100 and reporter reentry at N=29, derived from measured T=1.01s and B=30s. See race-stress-plan.json and review-audit.json.

  • Isolation preflight and final clean-source, formatting, discussion and receipt audit passed: checks/1794583147771980858-2.json. All ten changed files and linked issue #32718 were reviewed.

  • Frozen author reports of engine/disttae race, focused normal/negative controls, exact varchar selector and sampled coverage were assessed and reused with attribution.

Limitations:

  • Native engine/disttae fixtures were not independently rerun; local_validation contains no attached raw author artifacts. Hosted UT/SCA/coverage were pending.

  • Three existing native skips, the reported unchanged molint finding and preexisting unjoined publication worker remain limits. Sampled coverage and timing controls do not establish complete behavioral or whole-suite performance equivalence.

@matrix-meow matrix-meow added size/XL Denotes a PR that changes [1000, 1999] lines and removed size/L Denotes a PR that changes [500,999] lines labels Nov 13, 2026
@XuPeng-SH XuPeng-SH changed the title test: restore engine UT coverage on 4.2-dev test: restore engine coverage and reduce CI I/O on 4.2-dev Nov 13, 2026
@XuPeng-SH

XuPeng-SH commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 091f5114fe89268713bfa46108e47c1280f23622

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: 091f5114fe89268713bfa46108e47c1280f23622

Assessment: approve

Scoped logging and engine-local accounting reuse the existing owners. Quiet encoding preserves DEBUG guards, trace reporting and higher-level diagnostics; restored fixtures retain distinct object, checkpoint and varchar oracles. The missing-table assertion has different success/error semantics from the positive-subscription helper. The added mechanisms are proportionate, and the disclosed DEBUG-console and accidental repeated-RPC reductions are acceptable tradeoffs. No actionable defect found.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed all 13 changed files, linked issue 32718 and all five discussion entries; reconciled the earlier 43c1a17 approval against the current implementation in discussion-assessment.json.

  • Current-head logutil normal and final owning-package race runs each passed all 42 top-level tests with no skips. Logs: logutil-normal-recovered.log and logutil-race-final.log; command/source/exit receipts are reconciled in review-audit.json.

  • All 15 exact logger-scope race stress selections passed: thirteen at N=100, reporter reentry at N=29 (T=1.01s), and quiet mode at N=14 (T=2.03s), with B=30s. See race-stress-plan.json, stress-Test*.log and matching receipts.

  • Isolation preflight, logutil build/vet, and the 13-file formatting/license/diff/delivery/discussion audit passed. The initial dependency-download timeout produced no test result; switching the module proxy recovered validation using the same assigned caches. Local toolchain: Go 1.26.6, linux/amd64.

  • Reused the frozen author's Go 1.26.4 reports with attribution: full race engine package 169 passed/3 existing skips, disttae 410 passed, selected normal cases, original/restored selectors, cleanup repetitions and negative controls. Source tracing independently checked object forms, checkpoint bounds, exact subscription errors/state, reader/transaction cleanup and batch ownership.

  • Assessed the reported equal-host publication I/O samples and single full-package comparison at their stated limits; sampled coverage was not treated as per-case, branch or complete behavioral equivalence.

Limitations:

  • Native engine/disttae tests and performance experiments were not independently rerun; local_validation attaches no raw author artifacts. Hosted build/UT/SCA/coverage were pending in the supplied snapshot and are not counted as passes.

  • Quiet publication scopes deliberately omit DEBUG console output even on failure; guards, encoding, trace and INFO/WARN/ERROR remain. Two integration error cycles plus 1,000 state-cleanup iterations do not preserve the old 1,000 mock-RPC attempts' scheduling pressure.

  • The mock stream Send does not observe context, publication checkpoint workers are not joined, and mocked remote rollback is a no-op. These existing boundaries remain; the new contexts and cleanup controls do not prove hard send deadlines or remote rollback.

XuPeng-SH added a commit that referenced this pull request Nov 14, 2026
Combine #32747 and #32721, retain parallel scheduling and cold recovery coverage, and preserve repeated RPC and checkpoint-boundary scenarios.
@XuPeng-SH XuPeng-SH closed this Nov 14, 2026
XuPeng-SH added a commit that referenced this pull request Nov 15, 2026
## What type of PR is this?

- [x] Improvement
- [x] Test and CI

## Which issue(s) this PR fixes:

Part of #32744; related to #32718. Supersedes #32721. These trackers
should not be closed based on this PR alone.

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

Consolidate the race UT fixes and coverage restoration, and reduce
repeated fixture work, test logging and BVT waiting. The existing UT
phase layout and runner count are unchanged: the extra serialized
embedded-cluster phase from the previous revision is removed. The cold
invalid-timestamp recovery setup also remains intact. Recent CI results
show substantial fixed and configuration-dependent time, so the local
case savings below are not treated as full-job savings.

### Scenario mapping

| Before | After and coverage boundary |
| --- | --- |
| First CN replay can compete with LOG/TN startup before the fault is
exercised. | Start LOG/TN, wait for a TN shard and then start the
faulted first CN. Preserve the disconnect, resume timestamp, SQL and
prepared-reader assertions. Join startup before closing services,
removing data or releasing the admission lease. |
| Changed-list coverage before #32700 included three independently
created CN objects with two full blocks each; a separate 150-row varchar
test was also removed. | Restore all three 16,384-row CN objects and
pair each with its own flushed two-row TN object before one of three
checkpoints. Keep the independent 150-row varchar case and the existing
two-row selector. Verify changed IDs, checkpoint boundaries and row
results. |
| Missing-table subscription called the mocked RPC 1,000 times with 5 ms
pacing and repeated error logging. | Retain 1,000 actual mock-RPC cycles
and assert the missing error and cleaned state for each. Test transient
retry, cancellation and pending subscription separately; the
inter-attempt timing is intentionally different. The mock stream
observes context cancellation when its send blocks. |
| Checkpoint merge generated 100,000 uniform historical table IDs. |
Keep the same account, database, sequential-ID and timestamp shape, but
use 16,401 rows. In the measured runs, both cases wrote one object with
multiple 8,192-row blocks and a partial final block; assert at least
three persisted blocks, every ID, timestamps, user rows and the special
coverage row. The 100,000-row / 13-block stress volume is reduced and is
not claimed to be equivalent. |
| Publication tests needed DEBUG-path coverage, and test-owned
change-handle batches outlived their engines. | Scope DEBUG
configuration and retain DEBUG guards, field encoding and trace
reporting, but suppress DEBUG console entries in nine selected tests,
including on failure; INFO/WARN/ERROR remain. Release the three batches
after engine teardown. A caller already using DEBUG keeps console DEBUG
output. |
| FK database-copy regression built the same source separately for each
copy mode and identifier. | Reuse one source per
underscore/percent/backslash case, retain all six named
data-branch/clone subtests and each target, metadata, data, collision
and FK-error assertion. Check source rows again before reuse. The source
now survives across the two modes and therefore has different catalog
history. |
| Fulltext and IVF-FLAT clone/restore BVT cases each slept for 30 + 30 +
45 seconds. | Keep all original input rows, clone operations, searches
and expected results. Fulltext waits for source and cloned search
results; IVF-FLAT waits for source entries, a newer clone model with six
active entries and then eight entries after insertion. This adds
readiness assertions and changes when results are observed. The BVT
script set and grouping/order remain unchanged. |

### Measured impact and limits

- On one shared host, precompiled `-race -short -tags=matrixone_test`
binaries ran 11 selected engine cases in strict ABBA order: baseline
41.542 / 39.900 s; candidate 36.591 / 37.701 s. Captured output fell
from 4.73–4.77 MB to 2.77–2.78 MB. Process write counters include
captured output and are not device-wide I/O measurements.
- The checkpoint case itself measured 1.15 / 1.14 s before and 0.66 /
0.67 s after in the same style of comparison. These samples do not
establish full-lane I/O savings.
- The earlier #32747 race job took 77m19s: its exclusive phase took
about 27m49s and its added serial embedded-cluster phase took about
15m35s. The current head passed in 43m39s, with 42m05s in the Unit
Testing step. Removing the added phase does not imply a 15m35s saving:
its packages still run in the existing phases. After testing, the gap
between the analysis tool's first and next dependency-download messages
was 476s in the older run versus 4–27s in four other runs; the cause is
not established. Checkout, native build, report tooling and other fixed
costs are outside the individual case measurements. The full-job results
are independent samples, not a controlled attribution.
- The non-race UT coverage job's raw report was 197,479,585 bytes for
this head versus 205,342,435 bytes in the earlier #32747 run; runner
execution was 1,092.9 s versus 1,076.1 s. These are single runs on
different revisions/environments, not an attribution or a race-lane
comparison.
- With the CI mo-tester revision on a local three-CN embedded cluster,
the fulltext case measured 105.192 / 108.566 s before and 24.275 /
30.249 s after (ABBA). The IVF-FLAT case measured 106.700 s before and
50.264 / 40.255 / 32.557 s after across two local cluster runs; it also
took about 105 s in recent CI artifacts. The standalone fulltext
comparison enabled the feature in its session. These are case timings,
not CI job wall times.
- Actual group-1 pessimistic BVT: in run `43553630723` the fulltext and
vector scripts took 105.190 / 105.279 s; in run `43631272327` on this
head they took 30.247 / 36.368 s, all passing. The BVT step was 30m46s
versus 28m19s and the whole job 33m36s versus 30m55s. These are single
independent CI runs, so the total job difference cannot be attributed
solely to those cases.
- In four recent BVT runs the proxy job took 32m05s–36m36s and the
pessimistic job 23m17s–34m12s; the proxy job was longer with either
group assignment. In the current run the proxy job passed in 35m12s,
versus 35m17s in the older comparison run, so the pessimistic-case
savings did not translate into a comparable BVT critical-path reduction
in these samples. The group assignment rotates between configurations,
so a static group move could improve some runs and regress others.
- The grouping script is unchanged and declares 823 + 456 distinct
scripts in both runs, with no overlap. The tester actually started 817 +
456: the same six partition scripts were already marked
`@skip:issue#16438` and reported zero commands in both runs. The
declared and executed sets are identical before/after, with no new skip
or duplicate. The per-command ignored counts were also unchanged at 443
and 659 respectively.

## Validation

- Rebased on the latest observed `4.2-dev`; `gofmt`, `git diff --check`,
and `make static-check-selected` (repository molint and golangci-lint)
passed for the changed Go packages.
- `-short -race -tags=matrixone_test`: complete `pkg/logutil`,
`pkg/vm/engine/disttae`, `pkg/vm/engine/test/testutil`,
`pkg/vm/engine/test`, `pkg/tests/issues`, and `pkg/embed/firstreplay`
packages passed. `TestMarkScanGuardSQL` passed twice.
- Under race: 100 repetitions of the logger, mock-stream, replay
control-plane/cleanup and missing-table cleanup checks; 10 repetitions
of the subscription, transient retry and changed-list cases; two
repetitions of `TestCNFirstReplayDisconnect`; and 30 repetitions of
`TestCheckpointTableIDBatch2` with a private `/tmp` mount.
- The complete `pkg/vm/engine/tae/db/test` package passed under race
(248 passed, 13 existing skips) with a private `/tmp` mount because its
test helper uses hard-coded paths under `/tmp`; this PR adds no skips.
- Both changed BVT scripts passed with the real mo-tester and three CNs.
A vector negative control first observed eight indexed rows, then
deliberately expected nine: it failed exactly that assertion and the
tester exited nonzero.
- In one mo-tester session, each changed BVT script also passed
immediately after its historical predecessor (four scripts in order,
zero failures or ignored commands); the standalone session enabled the
fulltext feature as the earlier group scripts do.
- CI run `43631272327` passed UT race, both BVT groups and UT coverage.
The ARM static-analysis job is still running.

The race job met the one-hour target in this run; additional CI samples
are needed to assess its stability.

This branch had an error being deployed

1 failed deployment
ci — 091f5114 Deployed Nov 13, 2026 by XuPeng-SH
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/enhancement kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants