{"record":{"id":"4258a9bdf9f73276","repo":"apache/hadoop","slug":"providedreplica-does-not-support-renaming-data","errorCode":null,"errorMessage":"ProvidedReplica does not support renaming data","messagePattern":"ProvidedReplica does not support renaming data","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProvidedReplica.java","lineNumber":278,"sourceCode":"  public boolean deleteMetadata() {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not support deleting metadata\");\n  }\n\n  @Override\n  public long getMetadataLength() {\n    return NULL_CHECKSUM_ARRAY == null ? 0 : NULL_CHECKSUM_ARRAY.length;\n  }\n\n  @Override\n  public boolean renameMeta(URI destURI) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not support renaming metadata\");\n  }\n\n  @Override\n  public boolean renameData(URI destURI) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not support renaming data\");\n  }\n\n  @Override\n  public boolean getPinning(LocalFileSystem localFS) throws IOException {\n    return false;\n  }\n\n  @Override\n  public void setPinning(LocalFileSystem localFS) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not support pinning\");\n  }\n\n  @Override\n  public void bumpReplicaGS(long newGS) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not yet support writes\");","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProvidedReplica.java#L260-L296","documentation":"ProvidedReplica wraps an immutable FileRegion in a remote filesystem; its data URI is fixed at construction. renameData(URI) unconditionally throws UnsupportedOperationException because the DataNode cannot rename objects inside the external provided store.","triggerScenarios":"Calling renameData(destURI) on a ProvidedReplica - e.g. recovery/finalize code or block-migration utilities that relocate block data files by URI, applied to a replica on a PROVIDED volume.","commonSituations":"Running block-movement tooling (disk balancer plans, balancer-driven moves, custom volume migrations) against a DataNode configured with provided storage, or unit tests exercising ReplicaInfo.renameData on ProvidedReplica instances.","solutions":["Skip renameData() when the replica is PROVIDED (instanceof ProvidedReplica or ProvidedVolume check); provided data is address-stable.","Exclude PROVIDED volumes from any volume-choosing/moving logic (SupportedOperation checks on the volume).","If writes must land somewhere, target a local volume instead of the provided one.","Catch UnsupportedOperationException defensively at the caller boundary and log the immovable block."],"exampleFix":"// before\nboolean ok = replica.renameData(destUri);\n\n// after\nboolean ok = !(replica instanceof ProvidedReplica) && replica.renameData(destUri);","handlingStrategy":"validation","validationCode":"if (!(replica instanceof ProvidedReplica)) {\n  replica.renameData(destUri);\n}","typeGuard":"static boolean isProvided(ReplicaInfo r) {\n  return r instanceof ProvidedReplica;\n}","tryCatchPattern":"try {\n  replica.renameData(destUri);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Cannot rename data of PROVIDED replica {}: {}\",\n      replica.getBlockId(), e.getMessage());\n}","preventionTips":["Remember provided data URIs are immutable addresses into the remote store.","Exclude provided volumes from move/migrate plans.","Check FsVolumeSpi capabilities before attempting data relocation."],"tags":["hdfs","datanode","provided-storage","read-only","rename"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}