apache/hadoop · error · UnsupportedOperationException

Replica of type ${getState()} does not support createInfo

Error message

Replica of type ${getState()} does not support createInfo

What it means

createInfo() produces the ReplicaRecoveryInfo for the recovery handshake and is only implemented for replica states that participate in recovery. A FINALIZED FinalizedReplica throws UnsupportedOperationException, so any recovery flow that calls createInfo() on it has a missing state check. (Note: FinalizedReplica itself does not override createInfo here — the base behavior rejects it.)

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FinalizedReplica.java:144

    throw new UnsupportedOperationException("Replica of type " + getState() +
        " does not support getOriginalReplica");
  }

  @Override
  public long getRecoveryID() {
    throw new UnsupportedOperationException("Replica of type " + getState() +
        " does not support getRecoveryID");
  }

  @Override
  public void setRecoveryID(long recoveryId) {
    throw new UnsupportedOperationException("Replica of type " + getState() +
        " does not support setRecoveryID");
  }

  @Override
  public ReplicaRecoveryInfo createInfo() {
    throw new UnsupportedOperationException("Replica of type " + getState() +
        " does not support createInfo");
  }

  @Override
  public long getMetadataLength() {
    if (metaLength < 0) {
      metaLength = (int)super.getMetadataLength();
    }
    return metaLength;
  }

  public byte[] getLastPartialChunkChecksum() {
    return lastPartialChunkChecksum;
  }

  public void setLastPartialChunkChecksum(byte[] checksum) {
    lastPartialChunkChecksum = checksum;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Select the recovery participant replica (RUR/RBW/RWR) before building ReplicaRecoveryInfo.
  2. Fix the caller to skip or specially handle FINALIZED replicas instead of letting UnsupportedOperationException escape.
  3. Add tests that drive recovery with finalized replicas present.
  4. Check the Hadoop version for known fixes if this originates in framework code.

Example fix

// before
ReplicaRecoveryInfo info = replica.createInfo();

// after
if (replica instanceof ReplicaUnderReconstruction) {
  ReplicaRecoveryInfo info = replica.createInfo();
} else {
  // finalized replica: exclude from recovery handshake
}
Defensive patterns

Strategy: type-guard

Type guard

static boolean canBuildRecoveryInfo(ReplicaInfo r) {
  return r instanceof ReplicaUnderReconstruction;
}

Try / catch

try {
  ReplicaRecoveryInfo info = replica.createInfo();
} catch (UnsupportedOperationException e) {
  // FINALIZED replica cannot join the recovery handshake: exclude it and fix the caller
}

Prevention

When it happens

Trigger: Block recovery calling createInfo() on a replica with state FINALIZED instead of the under-reconstruction copy; generic code building recovery info from every replica in a volume-map scan.

Common situations: Custom recovery implementations; refactored framework flows that lost a type filter; integration tests that stub volume maps with finalized replicas.

Related errors


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