Skip to content

fix(pipeline): preserve terminal errors across spool abort - #25620

Merged
XuPeng-SH merged 1 commit into
mainfrom
fix/pipeline-spool-terminal-cause
Jul 11, 2026
Merged

XuPeng-SH merged 1 commit into
mainfrom
fix/pipeline-spool-terminal-cause

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:

issue #24971

What this PR does / why we need it:

A failing producer pipeline sends its typed terminal error and then aborts its pipeline spool to reclaim queued batches. If a receiver already has a GetFromSpool signal ahead of the terminal signal, that signal observes the aborted spool first. The spool previously returned the generic pipeline spool aborted sentinel, masking the producer's real error. This was observed when a recursive CTE correctly raised recursive level out of range, but the client intermittently received the generic spool error.

This PR makes the spool's abort cause explicit and first-wins:

  • PipelineSpool.Abort(cause) preserves the original terminal cause; nil retains the generic sentinel fallback.
  • Connector and dispatch pass the execution error on failed pipelines.
  • A graceful End delivery failure uses ErrPipelineEndSignalDeliveryFailed.
  • Regression tests cover queued data before both delivered and undeliverable terminal signals, shared dispatch spools, nil causes, and repeated Abort calls.

The change is cleanup-only: it adds no goroutines, waits, allocations, or data-path branches.

Validation:

  • go test -count=1 and go test -race -count=1 for pSpool, connector, and dispatch
  • dependent tests for process, pipeline, merge, and mergecte
  • go build, go vet, molint, and make err-check
  • full make build
  • online recursive CTE error reproduced 100 times with the expected error
  • recursive_cte.sql BVT: 45/45 passed

@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 merged commit 8574d36 into main Jul 11, 2026
28 checks passed
@XuPeng-SH
XuPeng-SH deleted the fix/pipeline-spool-terminal-cause branch July 11, 2026 10:11
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#25620)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24971

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

A failing producer pipeline sends its typed terminal error and then
aborts its pipeline spool to reclaim queued batches. If a receiver
already has a `GetFromSpool` signal ahead of the terminal signal, that
signal observes the aborted spool first. The spool previously returned
the generic `pipeline spool aborted` sentinel, masking the producer's
real error. This was observed when a recursive CTE correctly raised
`recursive level out of range`, but the client intermittently received
the generic spool error.

This PR makes the spool's abort cause explicit and first-wins:

- `PipelineSpool.Abort(cause)` preserves the original terminal cause;
nil retains the generic sentinel fallback.
- Connector and dispatch pass the execution error on failed pipelines.
- A graceful End delivery failure uses
`ErrPipelineEndSignalDeliveryFailed`.
- Regression tests cover queued data before both delivered and
undeliverable terminal signals, shared dispatch spools, nil causes, and
repeated Abort calls.

The change is cleanup-only: it adds no goroutines, waits, allocations,
or data-path branches.

Validation:

- `go test -count=1` and `go test -race -count=1` for `pSpool`,
`connector`, and `dispatch`
- dependent tests for `process`, `pipeline`, `merge`, and `mergecte`
- `go build`, `go vet`, `molint`, and `make err-check`
- full `make build`
- online recursive CTE error reproduced 100 times with the expected
error
- `recursive_cte.sql` BVT: 45/45 passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#25620)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24971

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

A failing producer pipeline sends its typed terminal error and then
aborts its pipeline spool to reclaim queued batches. If a receiver
already has a `GetFromSpool` signal ahead of the terminal signal, that
signal observes the aborted spool first. The spool previously returned
the generic `pipeline spool aborted` sentinel, masking the producer's
real error. This was observed when a recursive CTE correctly raised
`recursive level out of range`, but the client intermittently received
the generic spool error.

This PR makes the spool's abort cause explicit and first-wins:

- `PipelineSpool.Abort(cause)` preserves the original terminal cause;
nil retains the generic sentinel fallback.
- Connector and dispatch pass the execution error on failed pipelines.
- A graceful End delivery failure uses
`ErrPipelineEndSignalDeliveryFailed`.
- Regression tests cover queued data before both delivered and
undeliverable terminal signals, shared dispatch spools, nil causes, and
repeated Abort calls.

The change is cleanup-only: it adds no goroutines, waits, allocations,
or data-path branches.

Validation:

- `go test -count=1` and `go test -race -count=1` for `pSpool`,
`connector`, and `dispatch`
- dependent tests for `process`, `pipeline`, `merge`, and `mergecte`
- `go build`, `go vet`, `molint`, and `make err-check`
- full `make build`
- online recursive CTE error reproduced 100 times with the expected
error
- `recursive_cte.sql` BVT: 45/45 passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#25620)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24971

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

A failing producer pipeline sends its typed terminal error and then
aborts its pipeline spool to reclaim queued batches. If a receiver
already has a `GetFromSpool` signal ahead of the terminal signal, that
signal observes the aborted spool first. The spool previously returned
the generic `pipeline spool aborted` sentinel, masking the producer's
real error. This was observed when a recursive CTE correctly raised
`recursive level out of range`, but the client intermittently received
the generic spool error.

This PR makes the spool's abort cause explicit and first-wins:

- `PipelineSpool.Abort(cause)` preserves the original terminal cause;
nil retains the generic sentinel fallback.
- Connector and dispatch pass the execution error on failed pipelines.
- A graceful End delivery failure uses
`ErrPipelineEndSignalDeliveryFailed`.
- Regression tests cover queued data before both delivered and
undeliverable terminal signals, shared dispatch spools, nil causes, and
repeated Abort calls.

The change is cleanup-only: it adds no goroutines, waits, allocations,
or data-path branches.

Validation:

- `go test -count=1` and `go test -race -count=1` for `pSpool`,
`connector`, and `dispatch`
- dependent tests for `process`, `pipeline`, `merge`, and `mergecte`
- `go build`, `go vet`, `molint`, and `make err-check`
- full `make build`
- online recursive CTE error reproduced 100 times with the expected
error
- `recursive_cte.sql` BVT: 45/45 passed

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/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants