hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "maobaolong (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-13527) craeteLocatedBlock IsCorrupt logic is fault when all block are corrupt.
Date Fri, 04 May 2018 07:16:00 GMT
maobaolong created HDFS-13527:
---------------------------------

             Summary: craeteLocatedBlock IsCorrupt logic is fault when all block are corrupt.
                 Key: HDFS-13527
                 URL: https://issues.apache.org/jira/browse/HDFS-13527
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: hdfs, namenode
    Affects Versions: 3.2.0
            Reporter: maobaolong


the step is:

1. put a small file into hdfs FILEPATH
2. remove block replicas in all datanode blockpool.
3. restart datanode
4. restart namenode( leave safemode)
5. hdfs fsck FILEPATH -files -blocks  -locations 
6. namenode think this block is not corrupt block.


the code logic is:
{code:java}
// get block locations
    NumberReplicas numReplicas = countNodes(blk);
    final int numCorruptNodes = numReplicas.corruptReplicas();
    final int numCorruptReplicas = corruptReplicas.numCorruptReplicas(blk);
    if (numCorruptNodes != numCorruptReplicas) {
      LOG.warn("Inconsistent number of corrupt replicas for {}"
          + " blockMap has {} but corrupt replicas map has {}",
          blk, numCorruptNodes, numCorruptReplicas);
    }

    final int numNodes = blocksMap.numNodes(blk);
    final boolean isCorrupt;
    if (blk.isStriped()) {
      BlockInfoStriped sblk = (BlockInfoStriped) blk;
      isCorrupt = numCorruptReplicas != 0 &&
          numReplicas.liveReplicas() < sblk.getRealDataBlockNum();
    } else {
      isCorrupt = numCorruptReplicas != 0 && numCorruptReplicas == numNodes;
    }
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message