You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Tsz Wo (Nicholas), SZE (JIRA)" <ji...@apache.org> on 2008/10/22 00:48:44 UTC

[jira] Commented: (HADOOP-4388) Bug in Datanode transferBlocks code

    [ https://issues.apache.org/jira/browse/HADOOP-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641649#action_12641649 ] 

Tsz Wo (Nicholas), SZE commented on HADOOP-4388:
------------------------------------------------

For the same reason, should we do a try-catch in the second part of the loop?  Otherwise, an IOException thrown within the loop leads to exiting the method.

> Bug in Datanode transferBlocks code
> -----------------------------------
>
>                 Key: HADOOP-4388
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4388
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: dfs
>    Affects Versions: 0.17.0
>            Reporter: Suresh Srinivas
>            Assignee: Suresh Srinivas
>             Fix For: 0.20.0
>
>         Attachments: HADOOP-4388.patch, HADOOP-4388.patch
>
>
> In the following code, when the blocks to be transferred has an invalid block, all the blocks that follow it are also not transferred. That might not be the intended behavior. Instead of breaking out of the loop, perhaps the right thing to do is to ignore the invalid block and continue with transferring the rest.
> {noformat}
>   private void transferBlocks( Block blocks[], 
>                                DatanodeInfo xferTargets[][] 
>                                ) throws IOException {
>     for (int i = 0; i < blocks.length; i++) {
>       if (!data.isValidBlock(blocks[i])) {
>         String errStr = "Can't send invalid block " + blocks[i];
>         LOG.info(errStr);
>         namenode.errorReport(dnRegistration, 
>                              DatanodeProtocol.INVALID_BLOCK, 
>                              errStr);
>         //
>         // ******** This should be continue instead of break?
>         //
>         break;
>       }
>       int numTargets = xferTargets[i].length;
>       if (numTargets > 0) {
>         if (LOG.isInfoEnabled()) {
>           StringBuilder xfersBuilder = new StringBuilder();
>           for (int j = 0; j < numTargets; j++) {
>             DatanodeInfo nodeInfo = xferTargets[i][j];
>             xfersBuilder.append(nodeInfo.getName());
>             if (j < (numTargets - 1)) {
>               xfersBuilder.append(", ");
>             }
>           }
>           String xfersTo = xfersBuilder.toString();
>           LOG.info(dnRegistration + " Starting thread to transfer block " + 
>                    blocks[i] + " to " + xfersTo);                       
>         }
>         new Daemon(new DataTransfer(xferTargets[i], blocks[i], this)).start();
>       }
>     }
>   }
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.