Repository navigation
Description
Summary
TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows can fail in the Ubuntu/x86 race-enabled UT even when the JSON merge implementation and its dependencies are unchanged. The allocation-only assertion therefore blocks unrelated pull requests as a false regression.
Root cause
The test in pkg/sql/plan/function/func_json_valid_test.go uses testing.AllocsPerRun(3, ...) around the complete JSON merge execution for 1 row and 8192 rows. That closure includes result-vector reset/growth, every merge-builder operation, every result append, and race-build-only vector checks; it does not isolate wrapper construction.
testing.AllocsPerRun derives its result from the process-wide runtime.MemStats.Mallocs delta. In the much longer 8192-row instrumented path, unrelated/instrumentation-dependent Go allocations are therefore attributed to the wrapper assertion. This is outside the production wrapper-allocation invariant that the test intends to protect.
The test was introduced by #25728 and passed that pull request's Ubuntu/x86 race UT. The affected package source remained unchanged, but the same test later failed in #25911 with one=1, many=45. On current main, repeated Darwin/arm64 runs report one=1, many=1 both with and without -race. This pass/fail history with unchanged source pins the defect to the test boundary, not to JSON merge or #25911.
Impact
Confirmed impact: unrelated pull requests can fail the required Ubuntu/x86 UT and require a rerun.
There is no confirmed production correctness or allocation regression in json_merge_patch.
Reproduction / evidence
- Failing run: https://github.com/matrixorigin/matrixone/actions/runs/29736219928/job/88332146244?pr=25911
- Failure:
wrapper allocations must not grow with rows: one=1.000000 many=45.000000 - Original implementation PR add json_merge_patch, json_merge_preserve #25728 passed the same Ubuntu/x86 race UT.
- fix(logservice): preserve HAKeeper ID batch boundaries #25911 only changes
pkg/logservice/hakeeper_client.goand its test; the failing test runs in the separatepkg/sql/plan/functiontest binary. - Current main passes 100 repeated non-race runs and 20 repeated race runs on Darwin/arm64 with
one=1, many=1.
Proposed fix
Keep all JSON merge functional tests in the race-enabled suite, but compile this allocation-statistics-only test only for non-race builds. Go defines the race build tag specifically so tests whose timing or instrumentation behavior is incompatible with the detector can be excluded: https://go.dev/doc/articles/race_detector#Excluding_Tests
No production code should change.
Acceptance criteria
- The Ubuntu/x86
-racepackage test no longer executes the allocation-statistics-only assertion. - Non-race builds still execute
TestJsonMergePatchWrapperAllocationsDoNotScaleWithRowsand retain its 1-row versus 8192-row invariant. - JSON merge functional tests continue to run in both race and non-race builds.
pkg/sql/plan/functionpasses targeted race, non-race, and package-level tests.
Activity
iamlinjunhong commentedon Nov 4, 2026
Recurrence of the allocation-measurement failure class under non-race coverage instrumentation, recorded after independent PR/base checks. This comment does not reopen this issue or claim a new production regression.
0fac11533824441409e5e36d276b91c0e4bc1125Stable signature:
The complete failed-jobs log and complete root-job log were read. The summary has zero build failures and only this test plus its enclosing package failure. The failing command was
go test -mod=readonly -count=1 -json -short -v -tags matrixone_test -timeout=20m -p 8 -covermode=set -coverprofile=... -coverpkg=... ${test_scope}, with CGO enabled on Linux/amd64, Go 1.26.4. This is a measurement assertion, with no compile/type/static/security failure or stable product error in the log.Independent non-PR flaky-candidate evidence:
0fac11533824441409e5e36d276b91c0e4bc1125, the exact failing test passed 3 consecutive repetitions, no skips or failures. Usedmatrixone_test, CGO enabled, no race detector (matching the failing lane),covermode=set, and the same coverage selection policy from frozen CI revision79c604b5c2c265427185271ab68629c9a464cbd0: discover repository packages, apply the CI package exclusions, thencompact_coverage_profile.go -packages(438 instrumented packages).pkg/objectio/ioutil/sinker.goand its new executable ownership tests. The measured closure isPreExtendAndReset -> buildJsonMergePatch -> bytejson builder/vector append; it never calls Sinker or a spill path. Git tree/blob comparisons provepkg/sql/plan/function,pkg/container/bytejson,pkg/container/vector,pkg/testutil,pkg/common/mpool,pkg/common/malloc,pkg/vm/process,go.mod,go.sum, and.githubare identical between the official target and PR head. The changed Sinker file introduces no init/background work that could run during this measurement; its standalone tests run in a separate test binary.4.2-dev, resolved to7283f12d0eaf919e253dab4ed0d7dc0828c6ff8e. Temporarily detached the existing isolated task worktree at this exact commit, verified clean status, and ran the same command and coverage package list. The exact case passed 3 consecutive repetitions. Then restored the original task branch and exact PR head, with clean status. No baseline or PR source was edited. Failure absence on the clean control is the expected flaky-candidate result, not claimed as reproduction of the CI failure.ioutilnormal and race package runs (78 roots each), build/vet, 17 focused ownership regression roots with 1,601 race repetitions, andTestS3Writer_SortAndSyncall passed. The same head's Ubuntu/x86 UT job 126640087378 also succeeded.Reproduction/comparison command for both revisions, where
cover_pkgsis the CI-policy-selected 438-package list:Local controls used Darwin/arm64 Go 1.27.1; they match the race/tags/CGO/coverage modes, but do not claim Linux/amd64 reproduction. Raw commands, JSON events, source comparisons, and full CI logs are retained outside the source repository in the task evidence directory.
Disposition: non-PR flaky candidate, with all four required evidence categories checked. Reuse this issue solely as the tracking record; its closed state is not used as known-open-defect comparison evidence. No unrelated code or assertion threshold will be changed in #32164. Requesting one failed-jobs rerun of run
41849009910after recording this evidence.