Skip to content

fix: isolate colexec server by CN service - #25682

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
aptend:fix/25211-per-cn-colexec-server
Jul 14, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
aptend:fix/25211-per-cn-colexec-server

Conversation

@aptend

@aptend aptend commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Bug

What this PR does / why we need it

colexec.Server was a process-global singleton. Standalone Multi-CN runs multiple CN services in one process, so dispatch UUID registrations, remote pipeline state, and CN transaction segment state were shared across CNs. Cleanup from one CN could therefore remove another CN's registration and make remote notify wait until the 30-second timeout.

This PR:

  • creates one colexec.Server for every CN service;
  • stores it in the service-scoped runtime and removes the process-global singleton;
  • pins dispatch registration/cleanup and remote RPC handling to the owning CN server;
  • scopes transaction segment tracking by CN service;
  • removes the hidden global fallback in segment helpers;
  • adds a regression test proving that the same receiver UUID can exist on two CN services and cleanup remains isolated.

Related issue: #25211

Failure evidence and the standalone BVT reproduction are documented in this issue comment.

Which issue(s) this PR fixes

Related to #25211.

Testing

  • go test -count=1 -timeout 180s ./pkg/sql/colexec ./pkg/sql/colexec/dispatch ./pkg/sql/compile ./pkg/cnservice ./pkg/vm/engine/disttae
  • go test -count=1 -timeout 180s ./pkg/vm/engine/test
  • go test -race -count=1 -run '^TestServerIsIsolatedByCNService$' ./pkg/sql/colexec
  • go build ./pkg/sql/colexec/... ./pkg/sql/compile ./pkg/vm/engine/disttae ./pkg/cnservice ./pkg/vm/engine/test/testutil
  • go vet ./pkg/sql/colexec ./pkg/sql/colexec/dispatch ./pkg/sql/colexec/multi_update ./pkg/sql/compile ./pkg/vm/engine/disttae ./pkg/cnservice ./pkg/vm/engine/test/testutil

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

TestDeleteS3SimpleTable panicked with 'colexec server is not initialized
for CN' because the per-CN colexec server isolation (introduced in this
PR) requires each test to explicitly create a server for its service.

Add colexec.NewServer(proc.GetService()) in prepareTestCtx, matching the
pattern used by other test packages.

Co-Authored-By: Claude <[email protected]>
@XuPeng-SH
XuPeng-SH merged commit 17c9953 into matrixorigin:main Jul 14, 2026
1 of 4 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] Bug

## What this PR does / why we need it

`colexec.Server` was a process-global singleton. Standalone Multi-CN
runs multiple CN services in one process, so dispatch UUID
registrations, remote pipeline state, and CN transaction segment state
were shared across CNs. Cleanup from one CN could therefore remove
another CN's registration and make remote notify wait until the
30-second timeout.

This PR:

- creates one `colexec.Server` for every CN service;
- stores it in the service-scoped runtime and removes the process-global
singleton;
- pins dispatch registration/cleanup and remote RPC handling to the
owning CN server;
- scopes transaction segment tracking by CN service;
- removes the hidden global fallback in segment helpers;
- adds a regression test proving that the same receiver UUID can exist
on two CN services and cleanup remains isolated.

Related issue: matrixorigin#25211

Failure evidence and the standalone BVT reproduction are documented in
[this issue
comment](matrixorigin#25211 (comment)).

## Which issue(s) this PR fixes

Related to matrixorigin#25211.

## Testing

- `go test -count=1 -timeout 180s ./pkg/sql/colexec
./pkg/sql/colexec/dispatch ./pkg/sql/compile ./pkg/cnservice
./pkg/vm/engine/disttae`
- `go test -count=1 -timeout 180s ./pkg/vm/engine/test`
- `go test -race -count=1 -run '^TestServerIsIsolatedByCNService$'
./pkg/sql/colexec`
- `go build ./pkg/sql/colexec/... ./pkg/sql/compile
./pkg/vm/engine/disttae ./pkg/cnservice ./pkg/vm/engine/test/testutil`
- `go vet ./pkg/sql/colexec ./pkg/sql/colexec/dispatch
./pkg/sql/colexec/multi_update ./pkg/sql/compile ./pkg/vm/engine/disttae
./pkg/cnservice ./pkg/vm/engine/test/testutil`

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] Bug

## What this PR does / why we need it

`colexec.Server` was a process-global singleton. Standalone Multi-CN
runs multiple CN services in one process, so dispatch UUID
registrations, remote pipeline state, and CN transaction segment state
were shared across CNs. Cleanup from one CN could therefore remove
another CN's registration and make remote notify wait until the
30-second timeout.

This PR:

- creates one `colexec.Server` for every CN service;
- stores it in the service-scoped runtime and removes the process-global
singleton;
- pins dispatch registration/cleanup and remote RPC handling to the
owning CN server;
- scopes transaction segment tracking by CN service;
- removes the hidden global fallback in segment helpers;
- adds a regression test proving that the same receiver UUID can exist
on two CN services and cleanup remains isolated.

Related issue: matrixorigin#25211

Failure evidence and the standalone BVT reproduction are documented in
[this issue
comment](matrixorigin#25211 (comment)).

## Which issue(s) this PR fixes

Related to matrixorigin#25211.

## Testing

- `go test -count=1 -timeout 180s ./pkg/sql/colexec
./pkg/sql/colexec/dispatch ./pkg/sql/compile ./pkg/cnservice
./pkg/vm/engine/disttae`
- `go test -count=1 -timeout 180s ./pkg/vm/engine/test`
- `go test -race -count=1 -run '^TestServerIsIsolatedByCNService$'
./pkg/sql/colexec`
- `go build ./pkg/sql/colexec/... ./pkg/sql/compile
./pkg/vm/engine/disttae ./pkg/cnservice ./pkg/vm/engine/test/testutil`
- `go vet ./pkg/sql/colexec ./pkg/sql/colexec/dispatch
./pkg/sql/colexec/multi_update ./pkg/sql/compile ./pkg/vm/engine/disttae
./pkg/cnservice ./pkg/vm/engine/test/testutil`

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] Bug

## What this PR does / why we need it

`colexec.Server` was a process-global singleton. Standalone Multi-CN
runs multiple CN services in one process, so dispatch UUID
registrations, remote pipeline state, and CN transaction segment state
were shared across CNs. Cleanup from one CN could therefore remove
another CN's registration and make remote notify wait until the
30-second timeout.

This PR:

- creates one `colexec.Server` for every CN service;
- stores it in the service-scoped runtime and removes the process-global
singleton;
- pins dispatch registration/cleanup and remote RPC handling to the
owning CN server;
- scopes transaction segment tracking by CN service;
- removes the hidden global fallback in segment helpers;
- adds a regression test proving that the same receiver UUID can exist
on two CN services and cleanup remains isolated.

Related issue: matrixorigin#25211

Failure evidence and the standalone BVT reproduction are documented in
[this issue
comment](matrixorigin#25211 (comment)).

## Which issue(s) this PR fixes

Related to matrixorigin#25211.

## Testing

- `go test -count=1 -timeout 180s ./pkg/sql/colexec
./pkg/sql/colexec/dispatch ./pkg/sql/compile ./pkg/cnservice
./pkg/vm/engine/disttae`
- `go test -count=1 -timeout 180s ./pkg/vm/engine/test`
- `go test -race -count=1 -run '^TestServerIsIsolatedByCNService$'
./pkg/sql/colexec`
- `go build ./pkg/sql/colexec/... ./pkg/sql/compile
./pkg/vm/engine/disttae ./pkg/cnservice ./pkg/vm/engine/test/testutil`
- `go vet ./pkg/sql/colexec ./pkg/sql/colexec/dispatch
./pkg/sql/colexec/multi_update ./pkg/sql/compile ./pkg/vm/engine/disttae
./pkg/cnservice ./pkg/vm/engine/test/testutil`

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: XuPeng-SH <[email protected]>

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants