The interview problem

Practice prompt

A distributed analytics job loses a worker holding intermediate partitions. Recover useful work without combining outputs from incompatible attempts.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume deterministic map logic or an explicit mechanism to stabilize nondeterministic inputs. Identify shuffle blocks by job, stage, partition and attempt. Publish an authoritative winning map attempt and its block manifest only after output completion. Reducers fetch checksummed blocks and report missing outputs; the scheduler reruns the necessary producer work and invalidates consumers as required by the execution model.

2. Trace the design or derivation

Publish map attempts
  → fetch partition blocks
  → detect loss
  → recompute missing maps
  → retry reducers

Reducers must know which map attempt owns each partition and verify block integrity. If an old attempt finishes late, it must not replace the selected attempt's manifest. Reexecution assumes deterministic or otherwise safely repeatable transformations; external side effects belong behind a commit protocol rather than inside arbitrary retryable map work.

3. Calculate the example

With 200 map tasks each emitting 50 MB, total shuffle payload is 10 GB. Losing outputs from five maps requires regenerating about 250 MB of output under equal-size assumptions, not necessarily rerunning the entire job. A skewed map producing 4 GB changes that calculation dramatically.

4. Failure cases and trade-offs

Speculative attempts can publish different outputs; consumers must not mix them arbitrarily. Local disk loss may outlive the process, and completed reducers may need invalidation after a producer generation changes. Replicated shuffle storage reduces recomputation but adds network and storage cost. External side effects from map tasks require separate idempotency.

5. Validation, follow-ups and self-review

Kill producers during and after publication, corrupt blocks and trigger duplicate attempts. Compare final results to an exact small job. Follow-up: what if map output is nondeterministic? Reward attempt lineage, atomic manifests and selective recovery limits.

Sources and related practice

Technical reference: spark.apache.org — Shuffle and recomputation background.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Design a reproducible build artifact cache; Resume long-running business workflows.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.