Skip to content

bulk: audit empty-instance handling for execution locality across bulk jobs #173619

Description

Summary:
Bulk jobs that support an execution-locality filter plan their worker set via
dsp.SetupAllNodesPlanningWithOracle(... SingleLocalityFilter ...), which returns
an empty instance slice (nil error) when no live instance matches the filter.
Callers must guard this empty case; not all do.

Concrete finding:
restore_processor_planning.go computes
chunkSize := int(math.Sqrt(float64(md.numImportSpans))) / numNodes with no guard
against numNodes == 0. A RESTORE execution-locality filter matching zero live
instances divides by zero (panic). IMPORT guards this explicitly ("no SQL
instances match ..."); other callers should be checked.

Next steps:

  • Audit each SetupAllNodesPlanningWithOracle caller (backup, restore,
    compaction, revlog, merge, fingerprint) for empty-instance handling.
  • Fix the RESTORE divide-by-zero.
  • Consider centralizing the empty guard in the planning helper.

Epic CRDB-65504

Jira issue: CRDB-66930

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-disaster-recoveryC-investigationFurther steps needed to qualify. C-label will change.O-agentFiled by an AI agent; usually the result of a human/agent investigation sessionT-disaster-recovery

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions