Repository navigation
Description
Problem
The multi-table INSERT BVT can return internal error: context canceled instead of the actual execution error that caused the query to fail.
Observed in CI run 32945651664, job 98107580796:
- Case:
test/distributed/cases/dml/insert/multi_insert_schema.sql - Row: 86
- SQL:
insert all into conv (id, e) values (id + 10, name) select id, name from src where name = 'delta'; - Expected:
internal error: convert to MySQL enum failed: item delta is not in enum [alpha beta gamma other][12,0,0] - Actual:
internal error: context canceled
The invalid ENUM value is intentional: this is an unhappy-path test. The query must fail, but it must return the real ENUM conversion error and preserve the multi-table INSERT rollback semantics.
Root cause
The target pipeline raises the real ENUM conversion error and cancels sibling pipelines. The sibling HashBuild/JoinMap dependency then receives context.Canceled.
pkg/vm/message/joinMapDependency.go:NewJoinMapBuildError converts any non-*moerr.Error into moerr.NewInternalErrorNoCtx(err.Error()). For context.Canceled, this loses the cancellation type and cause and turns cleanup fallout into an ordinary internal error. Scope error aggregation can then select this derived error and mask the original execution error.
The relevant sequence in the CI log is:
- ENUM conversion error is logged.
joinMapDependency.gologscontext canceled.- The frontend returns
internal error: context canceled.
Scope / attribution
- PR #27560 introduced the multi-table INSERT fan-out topology that exposes this race.
- PR #27636 is not the cause; it changes transaction-timestamp-to-TIMESTAMP conversion and does not touch ENUM or JoinMap error propagation.
- This is not an OOM, CN crash, or Proxy connectivity failure.
Expected behavior
For the above SQL, the client must consistently receive the ENUM conversion error. context.Canceled from sibling cleanup must remain secondary. The operation must remain atomic and must not leave partial writes in any target table.
Acceptance criteria
- Preserve cancellation identity/cause when publishing JoinMap build failures.
- Ensure scope/pipeline aggregation prefers the causal execution error over sibling cancellation fallout, including joined/wrapped errors.
- Add a regression test covering a multi-table INSERT target conversion failure with a concurrent JoinMap/DEDUP dependency.
- Run the relevant BVT repeatedly (including Proxy multi-CN mode) and verify deterministic error text and rollback.
Activity
fix(pipeline): preserve JoinMap cancellation causes (#27648)
fix(pipeline): preserve JoinMap cancellation causes (matrixorigin#27648)
fix(pipeline): preserve JoinMap cancellation causes (matrixorigin#27648)
fix(pipeline): preserve JoinMap cancellation causes (matrixorigin#27648)