haiyang1987 commented on code in PR #6926:
URL: https://github.com/apache/hadoop/pull/6926#discussion_r1898911363
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java:
##########
@@ -3863,5 +3864,27 @@ public void setLastDirScannerFinishTime(long time) {
public long getPendingAsyncDeletions() {
return asyncDiskService.countPendingDeletions();
}
+
+ @Override
+ public void hardLinkOneBlock(ExtendedBlock srcBlock, ExtendedBlock dstBlock)
throws IOException {
Review Comment:
```
public void hardLinkOneBlock(ExtendedBlock srcBlock, ExtendedBlock dstBlock)
throws IOException {
ReplicaInfo srcReplicaInfo = getReplicaInfo(srcBlock);
FsVolumeImpl v = getVolume(srcBlock);
try (AutoCloseableLock lock = lockManager.writeLock(LockLevel.VOLUME,
dstBlock.getBlockPoolId(),
v.getStorageID())) {
BlockPoolSlice dstBPS = v.getBlockPoolSlice(dstBlock.getBlockPoolId());
LocalReplicaInPipeline replicaInfo = (LocalReplicaInPipeline)
v.createTemporary(dstBlock);
hardLinkBlockFiles(srcReplicaInfo, replicaInfo.getMetaFile(),
replicaInfo.getBlockFile());
File dstBlockFile = dstBPS.addFinalizedBlock(dstBlock.getLocalBlock(),
replicaInfo);
ReplicaInfo finalizedReplica = new
FinalizedReplica(dstBlock.getLocalBlock(),
v, dstBlockFile.getParentFile());
volumeMap.add(dstBlock.getBlockPoolId(), finalizedReplica);
}
}
```
How about using the existing method `hardLinkBlockFiles` to perform this
logic?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]