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
FinalizedReplica is a FINALIZED local replica. getOriginalReplica() returns the pre-truncation view of a replica and is implemented only by ReplicaUnderReconstruction; a finalized replica has no 'original' twin. Hitting this UnsupportedOperationException means the caller invoked a recovery API on a replica in the wrong state — a caller-side logic bug, not an environmental failure.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FinalizedReplica.java:126
@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
- Fix the caller: only call getOriginalReplica() when the replica is under reconstruction (instanceof ReplicaUnderReconstruction).
- Add a state assertion (ReplicaState.RUR/RBW/RWR) before recovery-API call sites.
- Write a unit test that drives the same flow against a FINALIZED replica to lock in the guard.
- If the call comes from framework code in a released Hadoop version, check for a fixed version and upgrade.
Example fix
// before
ReplicaInfo original = replica.getOriginalReplica();
// after: guard by replica type
if (replica instanceof ReplicaUnderReconstruction) {
ReplicaInfo original = replica.getOriginalReplica();
} 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) {
// FINALIZED replica in a truncate/recovery path: caller bug — fix the state check
} Prevention
- Only call getOriginalReplica() on ReplicaUnderReconstruction instances
- Add state assertions before recovery-API call sites in custom dataset code
- Unit-test recovery flows with FINALIZED replicas present in the volume map
When it happens
Trigger: Internal DataNode or custom code calling getOriginalReplica() on a replica whose getState() is FINALIZED — e.g., truncate/recovery logic that skipped its state check, or code that assumes every ReplicaInfo implements the full recovery API.
Common situations: Custom FsDataset implementations and tests that iterate the volume map and call recovery APIs uniformly; modified truncate-handling code that loses a state check; version upgrades adding new call sites that were never exercised against finalized replicas.
Related errors
- Replica of type ${getState()} does not support getRecoveryID
- Replica of type ${getState()} does not support setRecoveryID
- Replica of type ${getState()} does not support createInfo
- Replica of type ${getState()} does not support getOriginalRe
- Replica of type ${getState()} does not support getRecoveryID
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/97868a7a4efd0ebe.
Report an issue: GitHub.