Skip to content

refactor: make pipeline termination protocol explicit and cancellation-safe - #25273

Merged
XuPeng-SH merged 15 commits into
matrixorigin:mainfrom
XuPeng-SH:implement_24971
Jul 1, 2026
Merged

XuPeng-SH merged 15 commits into
matrixorigin:mainfrom
XuPeng-SH:implement_24971

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Jun 30, 2026 •

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:

This PR makes pipeline termination explicit and cancellation-safe.

  • Unifies WaitRegister and PipelineEdge terminal state so typed terminal signals close Done() consistently.
  • Adds edge terminal/reuse semantics for delivered, dropped, retried, and reset terminal events.
  • Makes pSpool.Abort() release pending spool batches immediately while preserving batches already handed to receivers until ReleaseCurrent.
  • Routes connector/dispatch data and cleanup paths through edge-aware helpers.
  • Adds unhappy-path coverage for full receiver channels, terminal retry, spool abort cleanup, edge reuse, and nil process cleanup logging.

Testing:

  • go test -v -count=1 -timeout 120s ./pkg/vm/process ./pkg/container/pSpool
  • go test -race -count=1 -timeout 120s ./pkg/vm/process ./pkg/container/pSpool
  • go test -v -count=1 -timeout 120s ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
  • go build ./pkg/container/pSpool ./pkg/vm/process ./pkg/sql/compile
  • go vet ./pkg/container/pSpool ./pkg/vm/process ./pkg/sql/compile
  • go test -ldflags="-extldflags '-L$(pwd)/cgo -lmo -L$(pwd)/thirdparties/install/lib -Wl,-rpath,@executable_path/lib'" -v -count=1 -timeout 120s -run 'TestCompileBuildSideForBroadcastJoin(SkipsEmptyCN|GroupsDuplicateCN)$' ./pkg/sql/compile

XuPeng-SH and others added 2 commits June 30, 2026 20:38
…rigin#24971)

Refactor pipeline cleanup paths to use explicit typed terminal events
(EventEnd/EventError/EventAbort) instead of the implicit nil-batch
counting convention, eliminating deadlock risks and ambiguity.

Key changes:
- PipelineEventType enum with typed signals (EventData/End/Error/Abort)
- PipelineEdge abstraction wrapping WaitRegister with observable
  terminal state (Done/Aborted/Err) and idempotent send guarantees
- PipelineSignalReceiver.GetNextBatch supports typed terminal events
  while maintaining backward compatibility with legacy nil-batch path
- connector/dispatch Reset() simplified to BuildCleanupSignal +
  sendTerminalSignalsToLocalRegs + sp.Abort()
- spool.Abort() for synchronous, idempotent resource release
- compile.go uses PipelineEdge.AsWaitRegister() for compatibility

Co-authored-by: Astra <[email protected]>
@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 Author

Choose a reason for hiding this comment

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

I found two substantive blockers here.

  1. Edge-level terminal state breaks the existing multi-sender WaitRegister contract.

PipelineEdge now treats End/Error/Abort as terminal for the whole edge: markTerminal() closes done, and later data sends are rejected once that terminal state is set. But the compile path still shares one WaitRegister across multiple upstream senders and relies on NilBatchCnt > 1 (newMergeScope, newMergeScopeByCN, constructDispatchLocalAndRemote).

That means the first sender that sends a typed terminal signal can seal the shared edge for everyone else. Remaining senders on the same shared merge edge will then fail SendData / TrySend, even though the receiver still expects more terminal accounting and possibly more data.

Suggested fix: do not make terminal state global to the shared edge while shared WaitRegisters still exist. Either keep terminal semantics per sender, or defer this edge-global terminal protocol until each sender has its own dedicated edge.

  1. Normal successful cleanup now aborts queued spool data before downstream has drained it.

On normal completion (pipelineFailed=false, err=nil), Connector.Reset / Dispatch.Reset send a typed terminal signal and then immediately call sp.Abort(). But Abort() marks the spool aborted and ReceiveBatch() will then return ErrPipelineSpoolAborted instead of delivering queued batches that were already published into the spool but not yet consumed.

So if the downstream merge still has buffered GetFromSpool signals when cleanup starts, already-produced rows are discarded during a successful shutdown.

Suggested fix: reserve sp.Abort() for failure/cancellation paths where dropping pending data is acceptable. On successful completion, keep the old drain-preserving path (or another mechanism that preserves queued spool data until receivers consume it).

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Addressed the review comments in 551cb53.

  • Fixed shared WaitRegister/PipelineEdge terminal semantics: normal EventEnd is now counted against NilBatchCnt, so Done() only closes after all expected sender Ends are delivered; EventError/EventAbort remain fatal first-wins and close Done immediately.
  • Fixed successful connector/dispatch cleanup: normal EventEnd no longer calls sp.Abort(), so queued GetFromSpool signals can still drain. Spool cache cleanup is deferred until the paired Merge cleanup has drained queued signals.
  • Added regression coverage for shared-End/data interleaving, connector success drain, dispatch broadcast drain, fatal full-channel cleanup, and typed-terminal spool cleanup without a nil End message.

Verified locally:

  • go test -v -count=1 -timeout 120s ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
  • go test -race -v -count=1 -timeout 120s -run 'TestPipelineEdge|TestPipelineSignalReceiverSharedEdge|TestPipelineSpool|TestConnectorReset|TestDispatchReset' ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
  • go vet ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
  • go build ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch

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

Re-reviewing the latest head: I still would not merge this yet, but the blocker set is narrower now.

What still looks wrong:

  1. the remote-input cleanup path in pkg/sql/compile/scope.go is still sending legacy nil terminals (NewPipelineSignalToDirectly(nil, err, ...)) instead of the new typed End/Error/Abort protocol;
  2. the abort-fallback timeout-budget concern is weaker now, but still not really disproven for the real production budget / multi-receiver case.

The first point is still the main blocker. On the latest head, shared receiver edges still exist with NilBatchCnt > 1, and the receiver treats legacy nil as a one-sender decrement. So a remote cleanup path that bypasses typed terminals can still leave the shared receiver waiting for the rest of the sender count until timeout instead of terminating the edge immediately.

Suggested fix:

  • in Scope.sendNotifyMessage.closeWithError, use typed cleanup terminals (NewEndSignal / NewErrorSignal / NewAbortSignal) instead of NewPipelineSignalToDirectly(nil, err, ...);
  • then add a targeted remote/multi-CN cleanup regression around that path.

The second point (budget inflation) now looks more like a bounded-latency concern than a clear correctness bug, so I would treat it as secondary compared with the protocol mismatch above.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Addressed the latest remote cleanup review in c86f58fc4: Scope.sendNotifyMessage now sends typed cleanup terminals instead of legacy nil terminal batches; normal End delivery failure falls back to typed Abort. Added compile-layer regressions for shared receiver typed Error and per-sender typed End. Local verification passed: targeted remote cleanup tests, related remote forwarding tests, full go test ./pkg/sql/compile, go build ./pkg/sql/compile, go vet ./pkg/sql/compile, and make err-check.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Follow-up from the full module review in 2b157b66f.

Found and fixed one additional protocol edge case:

  • BuildCleanupSignal(true, nil) previously produced EventError(nil), which let receivers observe an error terminal with a nil cause. That is semantically unsafe because PipelineSignalReceiver.GetNextBatch returns the terminal error directly.
  • Added ErrPipelineTerminalWithoutCause; EventError/EventAbort now always carry a non-nil cause. Connector/dispatch use the normalized terminal cause for logs and remote error notification.
  • Hardened PipelineEdge.SendData* for nil context to match the nil-safe behavior of the other send helpers.

Extra regression coverage added:

  • process signal constructors and cleanup signal normalization;
  • receiver returning the sentinel error for failed cleanup with no cause;
  • connector Reset sending typed failure with cause;
  • dispatch remote cleanup notifying a non-nil cause;
  • nil-context data send does not panic.

Local verification after this commit:

go test -count=1 -timeout 180s ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
go test -count=1 -timeout 180s ./pkg/sql/compile
go test -v -count=1 -timeout 120s -run 'TestCheckBootstrapRetriesSetBootstrapStateFailure|TestHandleBootstrapFailure' ./pkg/logservice
go test -v -count=1 -timeout 180s -run TestSpeedupAbortAllTxn ./pkg/tests/issues
go vet ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
go vet ./pkg/sql/compile ./pkg/logservice ./pkg/tests/issues
make err-check
git diff --check

All passed locally. PR checks restarted for the new head commit.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Follow-up from the second full module review in 6685cba6b.

Additional issue found and fixed:

  • Dispatch End-delivery fallback used a fresh PipelineSignalSendTimeout for each failed local receiver. In a multi-receiver cleanup path this could stretch cleanup to roughly failedReceivers * timeout.
  • sendAbortSignalsToFailedLocalRegs now uses one shared cleanup context/deadline for all failed receivers.
  • Added TestDispatchFallbackAbortUsesSharedTimeoutBudget to lock the bound and verify every failed edge is still marked terminal with ErrPipelineEndSignalDeliveryFailed.

Also tightened deferred spool cleanup comments in pSpool/connector/dispatch: the safety condition is that the paired Merge cleanup loop has returned. On the normal path it drains queued GetFromSpool; on timeout it releases current references and exits, so no receiver goroutine can later read pending signals.

CI note:

  • The current arm64 SCA failure at previous head 2b157b66f is not an err-check/code failure. The job failed during make config while downloading modules from proxy.golang.org with multiple unexpected EOF errors.

Local verification after this commit:

make err-check
git diff --check
CGO_CFLAGS="..." CGO_LDFLAGS="..." go test -v -count=1 -timeout 180s ./pkg/vm/process ./pkg/container/pSpool
CGO_CFLAGS="..." CGO_LDFLAGS="..." go test -v -count=1 -timeout 180s ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="..." CGO_LDFLAGS="..." go test -race -v -count=1 -timeout 240s -run 'TestPipelineEdge|TestPipelineSignalReceiver|TestPipelineSpool|TestDispatchFallbackAbortUsesSharedTimeoutBudget|TestDispatchResetFallsBackToAbortWhenEndSignalCannotBeDelivered|TestDispatchResetAbortsSpoolWhenSomeLocalRegIsFull|TestDispatchResetEndPreservesQueuedBroadcastBatchUntilDeferredCleanup' ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/dispatch
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go test -ldflags="..." -v -count=1 -timeout 180s -run 'TestRemoteNotifyCleanupUsesTypedErrorForSharedReceiver|TestRemoteNotifyCleanupUsesTypedEndForSingleSender|TestReceiveMessageFromCnServerIfConnector_ReturnsOnBlockedReceiverCancel|TestReceiveMsgAndForward_ReturnsOnBlockedReceiverCancel|TestReceiveMessageFromCnServerIfDispatch_PreservesCleanupOnOriginalRoot' ./pkg/sql/compile
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go test -ldflags="..." -v -count=1 -timeout 180s -run 'TestCheckBootstrapRetriesSetBootstrapStateFailure|TestHandleBootstrapFailure' ./pkg/logservice
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go test -ldflags="..." -v -count=1 -timeout 240s -run TestSpeedupAbortAllTxn ./pkg/tests/issues
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go vet -ldflags="..." ./pkg/sql/compile ./pkg/logservice ./pkg/tests/issues
CGO_CFLAGS="..." CGO_LDFLAGS="..." go vet ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Follow-up optimization in c7610cca5.

I tightened the cleanup send budget one step further:

  • Connector, Dispatch local cleanup, and compile remote notify now use one shared PipelineSignalSendTimeout context for the initial End/Error send and any fallback Abort.
  • This removes the remaining (End timeout + fallback Abort timeout) behavior. A cleanup sender now gets one terminal-send budget, not two serial budgets.
  • Fallback Abort still marks the edge terminal even when the shared context has already expired, so send-side terminal state remains observable through Done()/Err().

Added regressions:

  • TestConnectorResetUsesSharedTerminalSendBudget
  • TestDispatchResetUsesSharedTerminalSendBudget
  • TestRemoteNotifyCleanupUsesSharedTerminalSendBudget

Local verification:

CGO_CFLAGS="..." CGO_LDFLAGS="..." go test -v -count=1 -timeout 180s ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go test -ldflags="..." -count=1 -timeout 180s ./pkg/sql/compile
CGO_CFLAGS="..." CGO_LDFLAGS="..." go test -race -v -count=1 -timeout 240s -run 'TestConnectorResetUsesSharedTerminalSendBudget|TestConnectorResetFallsBackToAbortWhenEndSignalCannotBeDelivered|TestDispatchResetUsesSharedTerminalSendBudget|TestDispatchResetFallsBackToAbortWhenEndSignalCannotBeDelivered|TestDispatchResetAbortsSpoolWhenSomeLocalRegIsFull' ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="..." CGO_LDFLAGS="..." go vet ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go vet -ldflags="..." ./pkg/sql/compile
CGO_CFLAGS="..." CGO_LDFLAGS="..." go build ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="..." CGO_LDFLAGS="..." DYLD_LIBRARY_PATH="..." go build -ldflags="..." ./pkg/sql/compile
make err-check
git diff --check

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Follow-up closed-loop review update

New issue found and fixed in 89321d834:

  • Remote-run data forwarding still used the raw chan PipelineSignal path (receiveMessageFromCnServerIfConnector / receiveMsgAndForward). That bypassed PipelineEdge.Done()/Abort state, unlike local connector/dispatch data sends.
  • Fixed by routing remote forwarded batches through PipelineEdge.SendDataDirect. If the target receiver edge is already terminal, the current batch is cleaned and the forward loop exits normally; if the sender context is canceled, the existing QueryInterrupted behavior is preserved.
  • Added TestReceiveMsgAndForward_ReturnsOnReceiverTerminal and updated blocked-forward tests to use real PipelineEdge instances.

Test robustness improvement:

  • Relaxed the shared cleanup deadline regression tests from 100ms/<180ms to 200ms/<300ms. This still catches the old serial two-deadline behavior (~400ms) but reduces CI timing flake risk.

Local verification passed:

  • go test -count=1 ./pkg/sql/compile with MO CGo flags
  • go test -count=1 ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch with MO CGo flags
  • focused remote-forward / cleanup tests, including race
  • focused connector/dispatch cleanup tests, including race
  • go test -count=1 ./pkg/vm/process ./pkg/container/pSpool focused pipeline tests
  • go vet for compile, connector, dispatch, process, pSpool
  • git diff --check
  • make err-check

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Additional first-principles unhappy-path coverage in 278aa2f2b.

This commit is test-only and closes the remaining protocol boundary cases from the Q1/Q2/Q3 review:

  • Q2 / hang: PipelineEdge data sends blocked on a full channel now have explicit coverage showing Abort releases the sender.
  • Q2 / protocol closure: data sends after normal End are rejected.
  • Q1 / cleanup: connector Reset with nil Reg + live spool aborts and releases spool memory without panic.
  • Q1/Q2 / cleanup: dispatch Reset with a nil local receiver aborts the spool, still notifies healthy local receivers, and does not panic.
  • Q1/Q2 / remote forwarding: remote connector/forward paths return when the receiver edge is already terminal, and nil receiver returns a concrete error after cleaning the batch.

Local verification passed after the commit:

  • focused new tests for process, connector, dispatch, compile
  • go test -count=1 ./pkg/vm/process ./pkg/container/pSpool
  • go test -count=1 ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
  • go test -count=1 ./pkg/sql/compile
  • focused -race coverage for the new blocked/terminal paths
  • go vet and go build for touched modules
  • git diff --check
  • make err-check

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

Re-reviewing the latest head: the earlier remote-terminal and shared-timeout-budget concerns look addressed now, but I still see one remaining blocker.

CleanupDeferredSpool() can still run too early on the normal End path.

Both cleanupInOrder() and cleanupSenderReceiverPipeline() invoke deferred spool cleanup from the sender pipeline’s own teardown, but that does not guarantee every downstream local receiver using the same spool has finished draining and released its last consumed slot yet.

At the spool level, ForceCleanupAfterTerminalSignal() consumes the one-shot cleanupOnce and frees the currently cached buffers. Later ReleaseCurrent() calls on non-aborted receivers still put newly released batch buffers back into the spool cache (CacheBatch(...)), but there is then no second cleanup pass left to free those newly returned buffers.

So on successful runs with a fast sender and slower downstream receiver(s), this can leak spool-owned memory after the deferred cleanup fires too early.

Suggested fix:

  1. delay deferred spool cleanup until downstream receiver drain is actually confirmed, or
  2. after deferred cleanup has fired, make late ReleaseCurrent() free buffers directly instead of re-caching them.

The earlier shared-edge fatal / remote cleanup blockers look much better on this head; this deferred-cleanup lifecycle is the remaining issue I would fix before merge.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

Follow-up for the latest deferred-spool-cleanup review in 9a46e4511.

Root cause addressed:

  • ForceCleanupAfterTerminalSignal is a one-shot cache-wide cleanup. If a slower typed-terminal receiver released its current batch after that cleanup, ReleaseCurrent previously returned that batch memory to the spool cache, but no second cleanup pass would run. That could leave spool-owned memory cached after normal End cleanup.

Fix:

  • PipelineSpool now records when the final cache-wide cleanup has run.
  • Late ReleaseCurrent after terminal cleanup frees the current slot directly via cleanSlotLocked instead of re-caching it.
  • spoolBuffer.clean clears freed cache slices so the final cleanup leaves no stale references to freed buffers.
  • Added TestPipelineSpoolLateReleaseAfterTerminalCleanupFreesDirectly to reproduce the exact late-release lifecycle and assert the mpool returns to zero.

Local verification passed:

CGO_CFLAGS="-I/Users/xupeng/gitlab/matrixone/cgo -I/Users/xupeng/gitlab/matrixone/thirdparties/install/include" CGO_LDFLAGS="-L/Users/xupeng/gitlab/matrixone/thirdparties/install/lib -lusearch_c" go test -v -count=1 -timeout 120s ./pkg/container/pSpool
CGO_CFLAGS="-I/Users/xupeng/gitlab/matrixone/cgo -I/Users/xupeng/gitlab/matrixone/thirdparties/install/include" CGO_LDFLAGS="-L/Users/xupeng/gitlab/matrixone/thirdparties/install/lib -lusearch_c" go test -v -count=1 -timeout 180s ./pkg/vm/process ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="-I/Users/xupeng/gitlab/matrixone/cgo -I/Users/xupeng/gitlab/matrixone/thirdparties/install/include" CGO_LDFLAGS="-L/Users/xupeng/gitlab/matrixone/thirdparties/install/lib -lusearch_c" go test -race -v -count=1 -timeout 240s -run 'TestPipelineSpoolLateReleaseAfterTerminalCleanupFreesDirectly|TestPipelineSpoolForceCleanupAfterTerminalSignalDoesNotNeedNilEndMessage|TestPipelineSpoolAbortWaitsForAllCurrentBroadcastReceivers|TestConnectorResetEndPreservesQueuedSpoolBatchUntilDeferredCleanup|TestDispatchResetEndPreservesQueuedBroadcastBatchUntilDeferredCleanup' ./pkg/container/pSpool ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="-I/Users/xupeng/gitlab/matrixone/cgo -I/Users/xupeng/gitlab/matrixone/thirdparties/install/include" CGO_LDFLAGS="-L/Users/xupeng/gitlab/matrixone/thirdparties/install/lib -lusearch_c" go vet ./pkg/container/pSpool ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
CGO_CFLAGS="-I/Users/xupeng/gitlab/matrixone/cgo -I/Users/xupeng/gitlab/matrixone/thirdparties/install/include" CGO_LDFLAGS="-L/Users/xupeng/gitlab/matrixone/thirdparties/install/lib -lusearch_c" go build ./pkg/container/pSpool ./pkg/vm/process ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch
make err-check
git diff --check

Note: running the pSpool test without MO CGo flags fails locally at compile time with xxhash.h missing, so the verified commands use the repository CGo include/link flags.

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

Re-reviewed latest head 9a46e4511.

I do not see a remaining blocker in the current version.

What I re-checked:

  • WaitRegister is now a direct PipelineEdge alias, so terminal state is no longer split across two objects.
  • Shared-edge End/Error/Abort accounting now matches NilBatchCnt > 1: normal End waits for all expected senders, while fatal terminals latch first cause and deliver the remaining sender count.
  • Connector/Dispatch normal End preserves queued spool data and defers spool cleanup until the paired Merge cleanup returns; End delivery failure falls back to typed Abort and aborts the spool.
  • Remote notify cleanup and remote batch forwarding no longer bypass typed terminal / edge state.
  • The latest pSpool fix closes the late ReleaseCurrent case after terminal cleanup by freeing directly once the final cache-wide cleanup pass has run.
  • The HAKeeper bootstrap follow-up avoids panicking a background ticker on transient setBootstrapState failure; it now logs and retries on a later tick.

Local verification:

  • go test ./pkg/vm/process ./pkg/container/pSpool ./pkg/vm/pipeline -count=1 -timeout 120s
  • go test ./pkg/sql/colexec/connector ./pkg/sql/colexec/dispatch -count=1 -timeout 120s
  • targeted go test ./pkg/sql/compile for remote forwarding / typed cleanup / broadcast-build tests
  • targeted go test ./pkg/logservice -run ^TestCheckBootstrapRetriesSetBootstrapStateFailure$
  • go build and go vet for pSpool/process/pipeline/connector/dispatch/compile/logservice

CI is green. The branch is behind main, but I do not see a code-level reason to request changes.

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/refactor Code refactor size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants