{"record":{"id":"d05a67b4f9b678a4","repo":"apache/hadoop","slug":"providedreplica-does-not-yet-support-update","errorCode":null,"errorMessage":"ProvidedReplica does not yet support update","messagePattern":"ProvidedReplica does not yet support update","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":330,"sourceCode":"  public int compareWith(ScanInfo info) {\n    if (info.getFileRegion().equals(\n        new FileRegion(this.getBlockId(), new Path(getRemoteURI()),\n            fileOffset, this.getNumBytes(), this.getGenerationStamp()))) {\n      return 0;\n    } else {\n      return (int) (info.getBlockLength() - getNumBytes());\n    }\n  }\n\n  @Override\n  public void truncateBlock(long newLength) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not yet support truncate\");\n  }\n\n  @Override\n  public void updateWithReplica(StorageLocation replicaLocation) {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not yet support update\");\n  }\n\n  @Override\n  public void copyMetadata(URI destination) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not yet support copy metadata\");\n  }\n\n  @Override\n  public void copyBlockdata(URI destination) throws IOException {\n    throw new UnsupportedOperationException(\n        \"ProvidedReplica does not yet support copy data\");\n  }\n\n  @VisibleForTesting\n  public void setPathHandle(PathHandle pathHandle) {\n    this.pathHandle = pathHandle;","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ProvidedReplica.java#L312-L348","documentation":"updateWithReplica(StorageLocation) is used by FsDatasetImpl.moveBlockAcrossVolumes to re-point a replica's files at a new storage location after a block move. ProvidedReplica throws UnsupportedOperationException because its FileRegion/URI binding to the remote store cannot be re-targeted to another storage location.","triggerScenarios":"Disk balancer or block-mover logic selecting a PROVIDED volume as the destination of a move; the movement code calls updateWithReplica on the (provided) replica to record the new location.","commonSituations":"Running diskbalancer/balancer plans or DataNode volume-maintenance scripts on a node whose data dirs mix local DISK and PROVIDED volumes; the plan does not account for read-only provided volumes.","solutions":["Filter PROVIDED volumes out of balancer/diskbalancer plans and volume-choice logic (consult FsVolumeSpi supported operations / ProvidedVolumeImpl).","Never use a provided volume as a move destination; restrict moves to local volumes.","Guard updateWithReplica callers with an instanceof ProvidedReplica check and skip the move.","Catch UnsupportedOperationException during the move loop, log the block as immovable, and continue the plan."],"exampleFix":"// before\nreplica.updateWithReplica(newLocation);\n\n// after\nif (!(replica instanceof ProvidedReplica)) {\n  replica.updateWithReplica(newLocation);\n} else {\n  LOG.warn(\"Block {} is PROVIDED; skipping move to {}\",\n      replica.getBlockId(), newLocation);\n}","handlingStrategy":"validation","validationCode":"if (!(replica instanceof ProvidedReplica)) {\n  replica.updateWithReplica(newLocation);\n} else {\n  LOG.warn(\"Block {} is PROVIDED; skipping move to {}\",\n      replica.getBlockId(), newLocation);\n}","typeGuard":"static boolean isProvided(ReplicaInfo r) {\n  return r instanceof ProvidedReplica;\n}","tryCatchPattern":"try {\n  replica.updateWithReplica(newLocation);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Block {} cannot be moved (provided storage): {}\",\n      replica.getBlockId(), e.getMessage());\n}","preventionTips":["Generate diskbalancer/balancer plans that exclude PROVIDED volumes.","Treat provided blocks as immovable; plan around them.","Verify the destination volume supports writes before initiating a move."],"tags":["hdfs","datanode","provided-storage","disk-balancer","block-movement"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}