apache/hadoop · error · UnsupportedOperationException

ProvidedReplica does not yet support copy data

Error message

ProvidedReplica does not yet support copy data

What it means

copyBlockdata(URI destination) streams a replica's block bytes to a destination URI during FsDatasetImpl.copyBlock (replication target). ProvidedReplica throws UnsupportedOperationException because receiving and storing incoming block bytes into the external provided store is not supported - provided volumes only expose pre-existing aliased data.

Source

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

    throw new UnsupportedOperationException(
        "ProvidedReplica does not yet support truncate");
  }

  @Override
  public void updateWithReplica(StorageLocation replicaLocation) {
    throw new UnsupportedOperationException(
        "ProvidedReplica does not yet support update");
  }

  @Override
  public void copyMetadata(URI destination) throws IOException {
    throw new UnsupportedOperationException(
        "ProvidedReplica does not yet support copy metadata");
  }

  @Override
  public void copyBlockdata(URI destination) throws IOException {
    throw new UnsupportedOperationException(
        "ProvidedReplica does not yet support copy data");
  }

  @VisibleForTesting
  public void setPathHandle(PathHandle pathHandle) {
    this.pathHandle = pathHandle;
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Keep PROVIDED volumes out of write/replication volume selection (they are read-only serving tiers).
  2. Pre-check the target volume/replica type before copyBlockdata and fail fast with a descriptive error.
  3. Clean up any partially created ProvidedReplica in a finally/catch so the block map stays consistent.
  4. Catch UnsupportedOperationException at the copy boundary, roll back the replica registration, and report to the NameNode.

Example fix

// before
replica.copyBlockdata(destUri);

// after
if (replica instanceof ProvidedReplica) {
  throw new IOException("PROVIDED volume cannot receive block copies");
}
replica.copyBlockdata(destUri);
Defensive patterns

Strategy: validation

Validate before calling

if (replica instanceof ProvidedReplica) {
  throw new IOException("PROVIDED volume cannot receive block copies");
}
replica.copyBlockdata(destUri);

Type guard

static boolean isProvided(ReplicaInfo r) {
  return r instanceof ProvidedReplica;
}

Try / catch

try {
  replica.copyBlockdata(destUri);
} catch (UnsupportedOperationException e) {
  dataset.invalidate(bpid, replica.getBlock());
  throw new IOException("PROVIDED volume cannot receive block data", e);
}

Prevention

When it happens

Trigger: A replication or copy operation attempts to write incoming block bytes through a FinalizedProvidedReplica: copyBlockdata(destination) is invoked on a ProvidedReplica created on a PROVIDED volume.

Common situations: Mixed local+PROVIDED data dirs where the volume chooser or a test places new replicas on the provided volume; or custom FsDataset code that assumes every replica can receive a copy.

Related errors


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