Repository navigation
fix(compile): LOAD DATA with compressed file hangs due to empty dispatch source address - #25556
Conversation
…tch source address (matrixorigin#25554) compileExternScanParallelWrite hardcoded an empty address for the source scope, but matrixorigin#25537 replaced isSameCN with sameExecutionNode which correctly treats empty-vs-non-empty addresses as different execution nodes. This caused constructDispatchLocalAndRemote to generate RemoteRegs with empty NodeAddr, leading to infinite morpc retry to an empty address. Fix: pass the current CN address (c.addr) to constructScopeForExternal so sameExecutionNode correctly identifies the source and target as the same local node. Regression test added: TestSameExecutionNodeMatchesByAddressForLocalScope. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Requesting changes. The one-line fix is in the right direction, but the PR does not yet have an effective regression guard for this production hang.
- High: the new regression test does not exercise the changed behavior and would pass before this fix.
pkg/sql/compile/max_dop_test.go:248 only checks sameExecutionNode with equal/non-equal addresses. That helper already behaves that way on main, so this test would not catch the actual regression from pkg/sql/compile/compile.go:1892 where compileExternScanParallelWrite constructed the source scope with an empty address.
The contract that failed is in constructDispatchLocalAndRemote: for compressed LOAD DATA with mcpu > 1, the source external scope and local merge scopes must be classified as the same execution node, producing SendToAnyLocalFunc with RemoteRegs == 0 and no empty NodeAddr. Please make the regression test assert that actual compile shape, for example by extending TestCompileExternScanParallelWrite to inspect rs[0].PreScopes[0].RootOp.(*dispatch.Dispatch) and require:
- source scope
NodeInfo.Addr == testCompile.addr dispatchOp.FuncId == dispatch.SendToAnyLocalFunclen(dispatchOp.RemoteRegs) == 0len(dispatchOp.LocalRegs) == expected mcpu- no generated remote receive info with empty addr
That test should fail on the pre-fix line constructScopeForExternal("", false) and pass with constructScopeForExternal(c.addr, false). This is important because the unhappy path is a hang / infinite retry to an empty morpc address, so a helper-only test is too weak.
- Low: the PR currently fails whitespace hygiene.
git diff --check origin/main...pr/25556 reports:
pkg/sql/compile/max_dop_test.go:241: trailing whitespace.
Please run gofmt or remove the stray tab/blank whitespace around the new test.
… test (matrixorigin#25554) The previous TestSameExecutionNodeMatchesByAddressForLocalScope only tested the sameExecutionNode pure function which was unchanged by the fix, so reverting the compile.go change would leave it green. Replace it with TestCompileExternScanParallelWriteSourceScopeHasCorrectAddr which directly asserts: - source scope NodeInfo.Addr == current CN address (not empty) - dispatch operator has SendToAnyLocalFunc with zero RemoteRegs Verified: reverting the compile.go fix makes this test fail with expected="cn1:6001" actual="". Co-Authored-By: Claude Opus 4.8 <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #25554
What this PR does / why we need it:
PR #25537 replaced
isSameCNwithsameExecutionNodeinconstructDispatchLocalAndRemote. The new function correctly treats empty-vs-non-empty addresses as different execution nodes, butcompileExternScanParallelWritestill hardcoded an empty address for the source scope, causing:SendToAnyLocalFunc→ raises"SendToAnyLocalFunc should not send to remote""dial tcp4: missing address"infinite retryFix: Pass the current CN address (
c.addr) toconstructScopeForExternalincompileExternScanParallelWrite, sosameExecutionNodecorrectly identifies source and target as the same local node.Affected: All LOAD DATA with compressed files (flate/bz2/gzip/lz4) where
mcpu > 1. Not specific to any compression type.Verification
go vet ./pkg/sql/compile/✅go test ./pkg/sql/compile/✅TestSameExecutionNodeMatchesByAddressForLocalScoperegression test ✅🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.8 [email protected]