ritegarg commented on code in PR #6513: URL: https://github.com/apache/hadoop/pull/6513#discussion_r1476924158
########## hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java: ########## @@ -1585,15 +1585,26 @@ public Replica recoverClose(ExtendedBlock b, long newGS, public ReplicaHandler createRbw( StorageType storageType, String storageId, ExtendedBlock b, boolean allowLazyPersist) throws IOException { + return createRbw(storageType, storageId, b, allowLazyPersist, 0L); + } + + @Override // FsDatasetSpi + public ReplicaHandler createRbw( + StorageType storageType, String storageId, ExtendedBlock b, + boolean allowLazyPersist, long newGS) throws IOException { long startTimeMs = Time.monotonicNow(); try (AutoCloseableLock lock = lockManager.readLock(LockLevel.BLOCK_POOl, b.getBlockPoolId())) { ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(), b.getBlockId()); if (replicaInfo != null) { - throw new ReplicaAlreadyExistsException("Block " + b + - " already exists in state " + replicaInfo.getState() + - " and thus cannot be created."); + if (newGS != 0L) { + cleanupReplica(b.getBlockPoolId(), replicaInfo); Review Comment: Added -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org