Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7235

DataNode#transferBlock should report blocks that don't exist using reportBadBlock

    XMLWordPrintableJSON

Details

    Description

      When to decommission a DN, the process hangs.

      What happens is, when NN chooses a replica as a source to replicate data on the to-be-decommissioned DN to other DNs, it favors choosing this DN to-be-decommissioned as the source of transfer (see BlockManager.java). However, because of the bad disk, the DN would detect the source block to be transfered as invalidBlock with the following logic in FsDatasetImpl.java:

      /** Does the block exist and have the given state? */
        private boolean isValid(final ExtendedBlock b, final ReplicaState state) {
          final ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(), 
              b.getLocalBlock());
          return replicaInfo != null
              && replicaInfo.getState() == state
              && replicaInfo.getBlockFile().exists();
        }
      

      The reason that this method returns false (detecting invalid block) is because the block file doesn't exist due to bad disk in this case.

      The key issue we found here is, after DN detects an invalid block for the above reason, it doesn't report the invalid block back to NN, thus NN doesn't know that the block is corrupted, and keeps sending the data transfer request to the same DN to be decommissioned, again and again. This caused an infinite loop, so the decommission process hangs.

      Thanks qwertymaniac for reporting the issue and initial analysis.

      Attachments

        1. HDFS-7235.007.patch
          20 kB
          Yongjun Zhang
        2. HDFS-7235.007.patch
          20 kB
          Yongjun Zhang
        3. HDFS-7235.006.patch
          20 kB
          Yongjun Zhang
        4. HDFS-7235.005.patch
          20 kB
          Yongjun Zhang
        5. HDFS-7235.004.patch
          21 kB
          Yongjun Zhang
        6. HDFS-7235.003.patch
          8 kB
          Yongjun Zhang
        7. HDFS-7235.002.patch
          8 kB
          Yongjun Zhang
        8. HDFS-7235.001.patch
          11 kB
          Yongjun Zhang

        Activity

          People

            yzhangal Yongjun Zhang
            yzhangal Yongjun Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: