Rushabh S Shah created HDFS-10770:
-------------------------------------

             Summary: Namenode shouldn't change storage info if client reports 
different storage. (via reportBadBlock)
                 Key: HDFS-10770
                 URL: https://issues.apache.org/jira/browse/HDFS-10770
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: Rushabh S Shah


>From HDFS-10348 [comment | 
>https://issues.apache.org/jira/browse/HDFS-10348?focusedCommentId=15271522&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15271522].
This jira is created to discuss whether we should change the storageInfo in 
triplets if the client reports bad block with storage which is different than 
what the namenode thinks.
Here is the relevant code:
{code:title=DatanodeStorageInfo.java|borderStyle=solid}
public AddBlockResult addBlock(BlockInfo b, Block reportedBlock) {
    // First check whether the block belongs to a different storage
    // on the same DN.
    AddBlockResult result = AddBlockResult.ADDED;
    DatanodeStorageInfo otherStorage =
        b.findStorageInfo(getDatanodeDescriptor());

    if (otherStorage != null) {
      if (otherStorage != this) {
        // The block belongs to a different storage. Remove it first.
        otherStorage.removeBlock(b);
        result = AddBlockResult.REPLACED;
      } else {
        // The block is already associated with this storage.
        return AddBlockResult.ALREADY_EXIST;
      }
    }

    b.addStorage(this, reportedBlock);
    blocks.add(b);
    return result;
  }
{code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to