Files
wei liu 11737297b0 fix: route external snapshot copies by task type (#52638)
issue: #52575

## What changed

- Removed DataNode-version filtering from copy-segment scheduling.
- Kept local restore on `CopySegment` and routed external restore
through
  `ExternalCopySegment`.
- Retained payload-based external detection for older DataCoord clients.
- Made DataNode return `ServiceUnimplemented` for unknown task types.
- Normalized the exact legacy code-5 rejection for `ExternalCopySegment`
to
  the same unsupported-task error.
- Failed external restore immediately when the worker does not support
the
  task type, while keeping other worker errors retryable.
- Retained `QuerySlotResponse.version` for wire compatibility without
using
  it for worker capability selection.

## Why

Cloud worker endpoints can be pooled, so the version returned by a slot
endpoint does not reliably identify the DataNode that executes the task.
Version-based filtering can therefore exclude compatible workers
indefinitely.

The task type now acts as the capability boundary. New workers return a
typed
unsupported error for unknown task types. DataCoord also recognizes the
exact
legacy rejection returned by older workers, so an incompatible external
restore fails immediately instead of being requeued until the job
timeout.
Transient worker failures remain retryable. Local restore keeps its
existing
task type and behavior.

This change intentionally does not add failed-worker exclusion or
cross-worker
rerouting to the scheduler.

## Validation

- Rebasing onto `milvus/master` preserved the complete feature patch ID
and
  changed-file set without conflicts.
- Targeted race tests passed after the rebase for `pkg/taskcommon`,
`pkg/util/merr`, `internal/datacoord/session`, `internal/datacoord`, and
  `internal/datanode` with `dynamic,test` tags and disabled inlining.
- The tests cover typed unknown-task rejection, legacy RPC status
round-trip,
DataCoord fail-fast behavior, and retry preservation for unrelated
errors.
- `git diff --check` passed.

The post-rebase local C++ build is blocked by an unrelated
`milvus/master`
macOS/clang 19 error in `ConcurrentVector.cpp`, where `std::min`
receives
`int64_t` and `ssize_t`. This PR does not modify `internal/core`.

---------

Signed-off-by: Wei Liu <[email protected]>
2026-08-21 11:27:25 +08:00
..