[
https://issues.apache.org/jira/browse/HDFS-16757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852309#comment-17852309
]
ASF GitHub Bot commented on HDFS-16757:
---------------------------------------
LiuGuH commented on code in PR #5719:
URL: https://github.com/apache/hadoop/pull/5719#discussion_r1627144059
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java:
##########
@@ -1078,6 +1079,44 @@ public void blockGroupChecksum(final StripedBlockInfo
stripedBlockInfo,
datanode.metrics.addBlockChecksumOp(elapsed());
}
+ @Override
+ public void copyBlockCrossNamespace(
+ final ExtendedBlock srcBlock, final Token<BlockTokenIdentifier>
srcBlockToken,
+ final ExtendedBlock targetBlock, final Token<BlockTokenIdentifier>
targetBlockToken,
+ final DatanodeInfo targetDN) throws IOException {
+ updateCurrentThreadName("Copying block cross namespace " + srcBlock);
+ final DataOutputStream reply = getBufferedOutputStream();
+ try {
+ // Check access
+ checkAccess(reply, true, srcBlock, srcBlockToken,
+ Op.COPY_BLOCK_CROSS_NAMESPACE, BlockTokenIdentifier.AccessMode.COPY);
+ checkAccess(reply, true, targetBlock, targetBlockToken,
+ Op.COPY_BLOCK_CROSS_NAMESPACE,
BlockTokenIdentifier.AccessMode.WRITE);
+
+ // Async copy the block
+ Future<?> result = datanode.internalCopyBlockCrossNamespace(srcBlock,
targetBlock, targetDN);
+ try {
+ result.get(dnConf.getCopyBlockCrossNamespaceSocketTimeout(),
TimeUnit.MILLISECONDS);
Review Comment:
If srcBlock targetBlock not in a same datanode, it will use DataTransfer
. And DataTransfer will catch any exception in thread , so result.get() will
always can not catch IOException.
> 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: Haiyang Hu
> 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]