apache/hadoop · error · UnsupportedOperationException

setMapFinishTime() not supported for ReduceTask

Error message

setMapFinishTime() not supported for ReduceTask

What it means

ReduceTaskStatus does not accept a map finish time; setMapFinishTime() always throws UnsupportedOperationException (the parameter name shuffleFinishTime is a leftover — the value is never stored). Only MapTaskStatus implements this setter. It is invoked by framework code that updates timings when a phase completes, so calling it on reduce statuses is always a bug in the caller.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/ReduceTaskStatus.java:98

  }

  @Override
  void setSortFinishTime(long sortFinishTime) {
    this.sortFinishTime = sortFinishTime;
    if (0 == this.shuffleFinishTime){
      this.shuffleFinishTime = sortFinishTime;
    }
  }

  @Override
  public long getMapFinishTime() {
    throw new UnsupportedOperationException(
        "getMapFinishTime() not supported for ReduceTask");
  }

  @Override
  void setMapFinishTime(long shuffleFinishTime) {
    throw new UnsupportedOperationException(
        "setMapFinishTime() not supported for ReduceTask");
  }

  @Override
  public List<TaskAttemptID> getFetchFailedMaps() {
    return failedFetchTasks;
  }
  
  @Override
  public void addFetchFailedMap(TaskAttemptID mapTaskId) {
    failedFetchTasks.add(mapTaskId);
  }
  
  @Override
  synchronized void statusUpdate(TaskStatus status) {
    super.statusUpdate(status);
    
    if (status.getShuffleFinishTime() != 0) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Guard the call with status.getIsMap() before setting map finish time.
  2. For reduce timings use setShuffleFinishTime() / setSortFinishTime() / setFinishTime().
  3. Audit generic copy methods (for example status-merging helpers) for unconditional setMapFinishTime calls.

Example fix

// before
status.setMapFinishTime(ts);

// after
if (status.getIsMap()) {
  status.setMapFinishTime(ts);
} else {
  status.setFinishTime(ts);
}
Defensive patterns

Strategy: type-guard

Type guard

static boolean acceptsMapFinishTime(TaskStatus s) {
  return s != null && s.getIsMap();
}

Prevention

When it happens

Trigger: Calling status.setMapFinishTime(t) on a reduce attempt's status, e.g. shared progress-update code, custom TaskAttemptListeners, or deserialization hooks that replay map events onto reduce statuses.

Common situations: Porting map-side bookkeeping to a code path that also handles reduces; mock/fake status objects in tests replaced by real ReduceTaskStatus; MR1-to-MR2 migration code that copies status fields generically.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/e22f16b6d48ffb9c. Report an issue: GitHub.