[ 
https://issues.apache.org/jira/browse/HDFS-7439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14335088#comment-14335088
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7439:
-------------------------------------------

There are other places having similar problem:
- DFSOutputStream.DataStreamer.createBlockOutputStream(..)
- DFSOutputStream.DataStreamer.transfer(..)
- RemoteBlockReader2.checkSuccess(..)
- Dispatcher.PendingMove.receiveResponse(..)
- DataXceiver.replaceBlock(..)

The code has similar format
{code}
if (status != SUCCESS) {
  if (status == Status.ERROR_ACCESS_TOKEN) {
    throw new InvalidBlockTokenException(..);
  } else {
    throw new IOException(..);
  }
}
{code}
How about we add a utility method?



> Add BlockOpResponseProto's message to DFSClient's exception message
> -------------------------------------------------------------------
>
>                 Key: HDFS-7439
>                 URL: https://issues.apache.org/jira/browse/HDFS-7439
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Ming Ma
>            Assignee: Takanobu Asanuma
>            Priority: Minor
>         Attachments: HDFS-7439.1.patch
>
>
> When (BlockOpResponseProto#getStatus() != SUCCESS), it helps with debugging 
> if DFSClient can add BlockOpResponseProto's message to the exception message 
> applications will get. For example, instead of
> {noformat}
>         throw new IOException("Got error for OP_READ_BLOCK, self="
>             + peer.getLocalAddressString() + ", remote="
>             + peer.getRemoteAddressString() + ", for file " + file
>             + ", for pool " + block.getBlockPoolId() + " block " 
>             + block.getBlockId() + "_" + block.getGenerationStamp());
> {noformat}
> It could be,
> {noformat}
>         throw new IOException("Got error for OP_READ_BLOCK, self="
>             + peer.getLocalAddressString() + ", remote="
>             + peer.getRemoteAddressString() + ", for file " + file
>             + ", for pool " + block.getBlockPoolId() + " block " 
>             + block.getBlockId() + "_" + block.getGenerationStamp()
>             + ", status message " + status.getMessage());
> {noformat}
> We might want to check out all the references to BlockOpResponseProto in 
> DFSClient.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to