apache/hadoop · error · UnsupportedOperationException

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

Error message

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

What it means

FinalizedProvidedReplica represents a FINALIZED replica whose bytes live in external PROVIDED storage (HDFS-9906), not in DataNode-local files. getOriginalReplica() is only implemented by replicas under reconstruction (ReplicaUnderReconstruction), so calling it on a provided replica throws UnsupportedOperationException — the object has no local original to return.

Source

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

  @Override  // Object
  public boolean equals(Object o) {
    return super.equals(o);
  }

  @Override  // Object
  public int hashCode() {
    return super.hashCode();
  }

  @Override
  public String toString() {
    return super.toString();
  }

  @Override
  public ReplicaInfo getOriginalReplica() {
    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() +

View on GitHub (pinned to 2add963021)

Solutions

  1. Guard callers: check the replica type (instanceof ReplicaUnderReconstruction, or replica.isProvided()/getState()) before calling recovery APIs.
  2. Avoid initiating block recovery against blocks whose local copy is PROVIDED — recover from another DataNode's replica instead.
  3. Upgrade HDFS: provided-storage handling in recovery paths has been fixed incrementally; check release notes for your version.
  4. If this surfaces from your own dataset code, do not forward these calls to FinalizedProvidedReplica.

Example fix

// before
ReplicaInfo original = replica.getOriginalReplica();

// after: only replicas under reconstruction support recovery APIs
if (replica instanceof ReplicaUnderReconstruction) {
  ReplicaInfo original = replica.getOriginalReplica();
} else {
  // PROVIDED / FINALIZED replica: not recoverable locally, skip or fail over
}
Defensive patterns

Strategy: type-guard

Type guard

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

Try / catch

try {
  ReplicaInfo original = replica.getOriginalReplica();
} catch (UnsupportedOperationException e) {
  // replica is not under reconstruction (e.g., PROVIDED): skip local recovery handling
}

Prevention

When it happens

Trigger: Any code path that invokes ReplicaInfo.getOriginalReplica() on a provided replica: block-recovery flows (interDataNodeProtocol startBlockRecovery / commitBlockSynchronization) reaching a replica that is PROVIDED, or custom code walking the volume map and calling recovery APIs without a type check.

Common situations: Clusters with PROVIDED storage enabled where a recovery or truncate flow lands on a provided replica; newer call sites added to recovery code that predate provided-storage support; custom FsDatasetSpi extensions that route recovery calls to all replica types.

Related errors


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