Skip to content

[Bug]: parallel parquet LOAD sometimes reports a sibling shard's "context canceled" instead of the real error #29315

Closed

Description

@fengttt

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

95b1d2b

Other Environment Information

  • Hardware parameters: GitHub Actions runner
  • OS type: Linux
  • Others: multi-CN compose CI (multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC))

Actual Behavior

load_data/load_data_parquet.sql fails intermittently at the pq_file_fanout_rollback case. It failed on #29303, whose change is unrelated.

[load data infile {'filepath'='$resources/parquet/test_*.parquet', 'format'='parquet'} into table pq_file_fanout_rollback;]
[EXPECT RESULT]: invalid input: column name not found
[ACTUAL RESULT]: internal error: convert go error to mo error reading magic footer of parquet file: context canceled (read: 0)

The statement is supposed to fail, and it does, but with a sibling shard's cancellation instead of the error that caused it.

Expected Behavior

When one shard of a parallel parquet load fails, the load reports that shard's error (invalid input: column name not found), never a sibling's cancellation.

Steps to Reproduce

Intermittent in CI: a sibling shard must still be reading its file when the failing shard cancels the query. Locally the test passed 60/60.

Deterministic reproduction: open a parquet file through ParquetHandler.openFile with a context canceled by a sibling's error. The result is internal error: convert go error to mo error reading magic header of parquet file: context canceled, which is no longer recognisable as a cancellation.

Additional information

Root cause

  • When a shard fails, it cancels its siblings. The scheduler then reports the failing shard's error by recognising each sibling's error as that cancellation (normalizeScopeRunError / preferPrimaryScopeResult in pkg/sql/compile/compile.go, via errors.Is).
  • The parquet reader (pkg/sql/colexec/external/parquet.go, parquet_nested.go) converts every library error with moerr.ConvertGoError. That formats parquet-go's wrapped context.Canceled into an internal error, and the cancellation identity is lost.
  • The scheduler then can't tell the sibling's error is secondary, so whichever shard result is collected first wins.

Fix direction

Convert reader library errors so that a cancellation or deadline keeps its identity.

moerr.ConvertGoError itself must keep returning *moerr.Error: the RPC error encoders in pkg/pb/{pipeline,shard,lock,query} type-assert its result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions