Skip to content

test: reduce engine UT disk I/O (4.2-dev) - #32700

Merged
XuPeng-SH merged 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:xp/42-ut-shared-io
Nov 13, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:xp/42-ut-shared-io

Conversation

@XuPeng-SH

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 #32685. Shared I/O pressure can contribute to CI startup failures; this change does not claim to resolve that issue by itself.

What this PR does / why we need it:

TestHandleGetChangedList changes the process-global logger to DEBUG and leaves it that way for subsequent engine tests. The resulting logs substantially increase UT report and disk writes. Keep the caller's logger unchanged and assert that the test does not replace it, including on failed test paths. Subsequent tests no longer inherit unintended DEBUG logs, including when they fail; INFO/WARN/ERROR, assertion, panic, and race reports continue through the existing pipeline. Explicitly configured DEBUG remains enabled.

The same case checks table identity and timestamps, so it does not need 16,384 rows per table. Use two rows per table while asserting that compaction produced a persisted, non-appendable object and that the forced checkpoint covers the requested timestamp. The table-ID assertions remain unchanged.

Consolidate the separate varchar insert-only smoke test into the existing S3 insert/delete engine fixture. Keep its distinct varchar commit/read scenario, assert the pre-commit in-memory and post-commit CN-created-object paths and exact row count, and retain the separate mid-write dump/delete test. Each scenario has its own timeout; the new varchar transactions and modified post-commit read register rollback/reader cleanup on failure.

A matched local comparison of the entire owning package, with precompiled -race -short binaries and the same test settings, passed on both revisions. The baseline had 168 passing top-level tests and three skips; this change had 167 passing tests and the same three skips after consolidating one case.

Measurement Baseline This change Reduction
Test JSON 114,293,225 bytes 15,758,350 bytes 86.21%
Process-accounted writes 306,061,312 bytes 207,056,896 bytes 32.35%

These are single runs on a shared host. Process-accounted writes include the test report; they are not a measurement of physical device writes or all CI jobs.

Validation

  • Owning package: -race -short -tags matrixone_test, complete run; 167 passed and three existing skips.
  • Race repetitions: TestHandleGetChangedList 5 times, Test_BasicS3InsertDelete including its varchar subtest 19 times.
  • Normal-mode focused tests covering both changed cases, Test_DeleteUncommittedBlock, and Test_CNTransferTombstoneObjects.
  • A test-only caller-DEBUG control confirms the original logger and DEBUG setting remain in effect. A baseline negative control reproduces the global logger replacement.
  • Test-only failure injections exercised missing database lookup, canceled scenario cleanup, a closed transaction gate and a failing commit event. The fake storage rollback is a no-op, so this does not establish real remote transaction cleanup.
  • gofmt, git diff --check, go vet, repository molint, and incremental golangci-lint.

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

@XuPeng-SH

XuPeng-SH commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: a74d1899fe580375c2ebb4fada65bf8f58d9ffee

"interrupted"

@XuPeng-SH XuPeng-SH changed the title test: reduce engine UT disk I/O test: reduce engine UT disk I/O (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: b3eeb0f497ac2d30f566b0a3cc74fd205588794d

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: b3eeb0f497ac2d30f566b0a3cc74fd205588794d

Assessment: approve

The changes preserve caller logging and existing test contracts while reducing fixture data and reusing an engine fixture. Added storage-path assertions and scoped cleanup retain or strengthen the removed scenario’s coverage. No actionable findings.

Model: gpt-6.1-sol / max

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

Validation:

  • Reviewed the complete delta, discussion and linked issue; traced logger, checkpoint, workspace, reader and transaction cleanup owners. Coverage and lifecycle analysis are recorded in review-record.md.

  • Assigned isolation preflight, gofmt and frozen-range git diff --check passed. Receipts and logs match the clean frozen head in validation-audit.json.

  • Accepted attributed author reports of focused normal/race controls and the complete owning-package race run; these were not independently replayed.

Limitations:

  • Local focused race execution stopped before compilation because cgo/libmo.so was unavailable; no local behavioral-test pass is claimed.

  • Ubuntu UT and arm64 SCA were still running in the supplied CI snapshot.

  • Author-reported test results and single-run I/O measurements lack retained raw logs for independent verification; physical-device savings are not established.

@XuPeng-SH
XuPeng-SH merged commit 1d90e51 into matrixorigin:4.2-dev Nov 13, 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 was previously deployed

1 inactive deployment
ci — b3eeb0f4 Deployed Nov 13, 2026 by mergify[bot]
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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants