apache/hadoop · error · UnsupportedOperationException

Replica of type {} does not support createInfo

Error message

Replica of type {} does not support createInfo

What it means

ReplicaWaitingToBeRecovered.createInfo() throws UnsupportedOperationException: createInfo() builds a ReplicaRecoveryInfo (state, id, generation stamp for the recovery handshake) and only replicas actively under recovery can produce one. An RWR replica must be promoted to RUR (wrapped in ReplicaUnderRecovery) before the recovery protocol can ask it for info.

Source

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

    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 getRecoveryID");
  }

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

View on GitHub (pinned to 2add963021)

Solutions

  1. Wrap the replica first: new ReplicaUnderRecovery(rwrReplica, recoveryId).createInfo()
  2. Ensure initBlockRecovery() path is used - it performs the wrapping for you
  3. Guard calls with a state check for ReplicaState.RUR before createInfo()

Example fix

// before
ReplicaRecoveryInfo info = replica.createInfo(); // throws for RWR

// after
ReplicaRecoveryInfo info = (replica.getState() == ReplicaState.RUR)
    ? replica.createInfo()
    : new ReplicaUnderRecovery(replica, recoveryId).createInfo();
Defensive patterns

Strategy: type-guard

Validate before calling

import org.apache.hadoop.hdfs.server.protocol.ReplicaState;
if (replica.getState() != ReplicaState.RUR) {
  replica = new ReplicaUnderRecovery(replica, recoveryId);
}
ReplicaRecoveryInfo info = replica.createInfo();

Type guard

static boolean canCreateInfo(ReplicaInfo r) {
  return r instanceof ReplicaUnderRecovery;
}

Try / catch

try { info = r.createInfo(); } catch (UnsupportedOperationException e) { info = new ReplicaUnderRecovery(r, recoveryId).createInfo(); }

Prevention

When it happens

Trigger: Calling createInfo() on a ReplicaWaitingToBeRecovered instance - e.g., during initBlockRecovery the code iterates replicas and calls createInfo() to build ReplicaRecoveryInfo for the NameNode, hitting an RWR entry without converting it first.

Common situations: Custom or test recovery flows that skip the ReplicaUnderRecovery wrapping step; downstream forks where block recovery was refactored and the RWR promotion was lost.

Related errors


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