Skip to content

test(function): exclude JSON allocation check under race - #25915

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/issue-25914-json-merge-alloc-test
Jul 20, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:fix/issue-25914-json-merge-alloc-test

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #25914

What this PR does / why we need it:

Root cause

TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows measures the complete 8192-row JSON merge path with testing.AllocsPerRun(3), even though its asserted invariant is wrapper allocation behavior. Under -race, that path also executes instrumented and race-build-only vector operations, so process-wide allocation deltas outside the intended invariant can be charged to the test.

The same package source passed the Ubuntu/x86 race UT in #25728, then failed an unrelated PR in #25911 with one=1, many=45. #25911 only changes the HAKeeper client and its tests, which run in a separate package test binary.

Fix

Move the allocation-statistics-only test unchanged into a !race test file.

This keeps:

  • the 1-row versus 8192-row allocation regression assertion in non-race builds;
  • all JSON merge functional tests in both race and non-race builds;
  • production code and JSON merge behavior unchanged.

Validation

.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=100 -timeout=10m \
  -run '^TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows$' \
  ./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=20 -timeout=10m \
  -run '^TestJsonMerge($|DepthValidation$)' \
  ./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=20 -timeout=10m \
  -run '^TestJsonMerge($|DepthValidation$|PatchWrapperAllocationsDoNotScaleWithRows$)' \
  ./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m \
  ./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=30m \
  ./pkg/sql/plan/function

The race-built test list was also checked to confirm that only the allocation-statistics test is excluded.

@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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No blocking findings on the latest head.

This keeps the allocation-regression assertion in non-race builds, leaves the JSON merge functional coverage in both race and non-race configurations, and does not change production code or JSON merge behavior. I do not see a correctness, closure, or unhappy-path issue with moving this allocator-sensitivity check behind !race.

@mergify mergify Bot added the queued label Jul 20, 2026
@mergify

mergify Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-20 14:48 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-20 15:47 UTC · at 2a1653e39129bb5b4026baffc7f510f854ae943a · squash

This pull request spent 59 minutes 7 seconds in the queue, including 58 minutes 29 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection] (documentation)
  • github-review-decision = APPROVED [🛡 GitHub branch protection] (documentation)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64

@mergify
mergify Bot merged commit 0102f7b into matrixorigin:main Jul 20, 2026
23 of 24 checks passed
@mergify mergify Bot removed the queued label Jul 20, 2026
iamlinjunhong pushed a commit to iamlinjunhong/matrixone that referenced this pull request Jul 23, 2026
…n#25915)

### Root cause

`TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows` measures the complete 8192-row JSON merge path with `testing.AllocsPerRun(3)`, even though its asserted invariant is wrapper allocation behavior. Under `-race`, that path also executes instrumented and race-build-only vector operations, so process-wide allocation deltas outside the intended invariant can be charged to the test.

The same package source passed the Ubuntu/x86 race UT in matrixorigin#25728, then failed an unrelated PR in matrixorigin#25911 with `one=1, many=45`. matrixorigin#25911 only changes the HAKeeper client and its tests, which run in a separate package test binary.

### Fix

Move the allocation-statistics-only test unchanged into a `!race` test file.

This keeps:

- the 1-row versus 8192-row allocation regression assertion in non-race builds;
- all JSON merge functional tests in both race and non-race builds;
- production code and JSON merge behavior unchanged.

### Validation

```text
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=100 -timeout=10m \
-run '^TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows$' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$|PatchWrapperAllocationsDoNotScaleWithRows$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=30m \
./pkg/sql/plan/function
```

The race-built test list was also checked to confirm that only the allocation-statistics test is excluded.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…n#25915)

### Root cause

`TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows` measures the complete 8192-row JSON merge path with `testing.AllocsPerRun(3)`, even though its asserted invariant is wrapper allocation behavior. Under `-race`, that path also executes instrumented and race-build-only vector operations, so process-wide allocation deltas outside the intended invariant can be charged to the test.

The same package source passed the Ubuntu/x86 race UT in matrixorigin#25728, then failed an unrelated PR in matrixorigin#25911 with `one=1, many=45`. matrixorigin#25911 only changes the HAKeeper client and its tests, which run in a separate package test binary.

### Fix

Move the allocation-statistics-only test unchanged into a `!race` test file.

This keeps:

- the 1-row versus 8192-row allocation regression assertion in non-race builds;
- all JSON merge functional tests in both race and non-race builds;
- production code and JSON merge behavior unchanged.

### Validation

```text
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=100 -timeout=10m \
-run '^TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows$' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$|PatchWrapperAllocationsDoNotScaleWithRows$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=30m \
./pkg/sql/plan/function
```

The race-built test list was also checked to confirm that only the allocation-statistics test is excluded.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…n#25915)

### Root cause

`TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows` measures the complete 8192-row JSON merge path with `testing.AllocsPerRun(3)`, even though its asserted invariant is wrapper allocation behavior. Under `-race`, that path also executes instrumented and race-build-only vector operations, so process-wide allocation deltas outside the intended invariant can be charged to the test.

The same package source passed the Ubuntu/x86 race UT in matrixorigin#25728, then failed an unrelated PR in matrixorigin#25911 with `one=1, many=45`. matrixorigin#25911 only changes the HAKeeper client and its tests, which run in a separate package test binary.

### Fix

Move the allocation-statistics-only test unchanged into a `!race` test file.

This keeps:

- the 1-row versus 8192-row allocation regression assertion in non-race builds;
- all JSON merge functional tests in both race and non-race builds;
- production code and JSON merge behavior unchanged.

### Validation

```text
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=100 -timeout=10m \
-run '^TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows$' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$|PatchWrapperAllocationsDoNotScaleWithRows$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=30m \
./pkg/sql/plan/function
```

The race-built test list was also checked to confirm that only the allocation-statistics test is excluded.

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…n#25915)

### Root cause

`TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows` measures the complete 8192-row JSON merge path with `testing.AllocsPerRun(3)`, even though its asserted invariant is wrapper allocation behavior. Under `-race`, that path also executes instrumented and race-build-only vector operations, so process-wide allocation deltas outside the intended invariant can be charged to the test.

The same package source passed the Ubuntu/x86 race UT in matrixorigin#25728, then failed an unrelated PR in matrixorigin#25911 with `one=1, many=45`. matrixorigin#25911 only changes the HAKeeper client and its tests, which run in a separate package test binary.

### Fix

Move the allocation-statistics-only test unchanged into a `!race` test file.

This keeps:

- the 1-row versus 8192-row allocation regression assertion in non-race builds;
- all JSON merge functional tests in both race and non-race builds;
- production code and JSON merge behavior unchanged.

### Validation

```text
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=100 -timeout=10m \
-run '^TestJsonMergePatchWrapperAllocationsDoNotScaleWithRows$' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=20 -timeout=10m \
-run '^TestJsonMerge($|DepthValidation$|PatchWrapperAllocationsDoNotScaleWithRows$)' \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m \
./pkg/sql/plan/function

.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=30m \
./pkg/sql/plan/function
```

The race-built test list was also checked to confirm that only the allocation-statistics test is excluded.

Approved by: @XuPeng-SH

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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: JSON merge allocation test flakes under race instrumentation

3 participants