[
https://issues.apache.org/jira/browse/HDFS-16757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17906244#comment-17906244
]
ASF GitHub Bot commented on HDFS-16757:
---------------------------------------
LiuGuH commented on code in PR #6926:
URL: https://github.com/apache/hadoop/pull/6926#discussion_r1887840665
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java:
##########
@@ -1152,4 +1153,14 @@ void setDeleteDuplicateReplicasForTests(
this.deleteDuplicateReplicas = deleteDuplicateReplicasForTests;
}
+ public File hardLinkOneBlock(File src, File srcMeta, Block dstBlock) throws
IOException {
+ File dstMeta = new File(tmpDir,
+ DatanodeUtil.getMetaName(dstBlock.getBlockName(),
dstBlock.getGenerationStamp()));
+ HardLink.createHardLink(srcMeta, dstMeta);
+
+ File dstBlockFile = new File(tmpDir, dstBlock.getBlockName());
+ HardLink.createHardLink(src, dstBlockFile);
Review Comment:
>>do you use this feature on a large scale? Does creating a lot of hard
links have a maintenance impact on the system?
Now Hadoop version upgrade depends on linux hardlink. And hardlink is
lightweight and it only link a new pointer points to the original file.
>> Have you considered implementing it based on rename?
Now src and dst have different block name. And it points the same file
address. @tomscut
> Add a new method copyBlockCrossNamespace to DataNode
> ----------------------------------------------------
>
> Key: HDFS-16757
> URL: https://issues.apache.org/jira/browse/HDFS-16757
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Reporter: ZanderXu
> Assignee: liuguanghua
> Priority: Minor
> Labels: pull-request-available
>
> Add a new method copyBlockCrossNamespace in DataTransferProtocol at the
> DataNode Side.
> This method will copy a source block from one namespace to a target block
> from a different namespace. If the target DN is the same with the current DN,
> this method will copy the block via HardLink. If the target DN is different
> with the current DN, this method will copy the block via TransferBlock.
> This method will contains some parameters:
> * ExtendedBlock sourceBlock
> * Token<BlockTokenIdentifier> sourceBlockToken
> * ExtendedBlock targetBlock
> * Token<BlockTokenIdentifier> targetBlockToken
> * DatanodeInfo targetDN
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]