[ https://issues.apache.org/jira/browse/HDFS-8096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14486802#comment-14486802 ]
Uma Maheswara Rao G commented on HDFS-8096: ------------------------------------------- Thanks Vinay for the patch. Makesense to me for incrementing the metric count only when real transfer happened. I agree for having test for intermediate failures would be difficult. Thanks for having one positive test here. +1 > DatanodeMetrics#blocksReplicated will get incremented early and even for > failed transfers > ----------------------------------------------------------------------------------------- > > Key: HDFS-8096 > URL: https://issues.apache.org/jira/browse/HDFS-8096 > Project: Hadoop HDFS > Issue Type: Bug > Components: datanode > Reporter: Vinayakumar B > Assignee: Vinayakumar B > Attachments: HDFS-8096-01.patch > > > {code} case DatanodeProtocol.DNA_TRANSFER: > // Send a copy of a block to another datanode > dn.transferBlocks(bcmd.getBlockPoolId(), bcmd.getBlocks(), > bcmd.getTargets(), bcmd.getTargetStorageTypes()); > dn.metrics.incrBlocksReplicated(bcmd.getBlocks().length);{code} > In the above code to handle replication transfers from namenode, > {{DatanodeMetrics#blocksReplicated}} is getting incremented early, since the > transfer will happen in background. > And even failed transfers also getting counted. > Correct place to increment this counter is {{DataTransfer#run()}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)