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

Incorrect calculation of NonDfsUsed and Remaining

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.6.0
    • None
    • datanode
    • None

    Description

      After reserve some space via the param "dfs.datanode.du.reserved", we noticed that the namenode usually report NonDfsUsed of Datanodes as 0 even if we write some non-hdfs data to the volume. After some investigation, we think there is an issue in the calculation of FsVolumeImpl.getAvailable - following is the explaination.

      For a volume, let's use Raw to represent raw capacity, DfsUsed to represent space consumed by hdfs blocks, Reserved to represent reservation through "dfs.datanode.du.reserved", RbwReserved to represent space reservation for rbw blocks, RealNonDfsUsed to represent real value of NonDfsUsed(which will include non-hdfs files and meta data consumed by local filesystem).
      In current implementation, for a volume, available space will be actually calculated as

      min{Raw - Reserved - DfsUsed -RbwReserved,  Raw - DfsUsed - RealNonDfsUsed }
      

      Later on, Namenode will calculate NonDfsUsed of the volume as

      Raw - Reserved - DfsUsed - min{Raw - Reserved - DfsUsed - RbwReserved, Raw - DfsUsed - RealNonDfsUsed}
      

      Given the calculation, finally we will have -

      if (Reserved + RbwReserved > RealNonDfsUsed) NonDfsUsed = RbwReserved;
      else NonDfsUsed = RealNonDfsUsed - Reserved;
      

      Either way it is far from the correct value.

      After investigating the implementation, we believe the Reserved and RbwReserved should be subtract from available in getAvailable since they are actually not available to hdfs in any sense. I'll post a patch soon.

      Attachments

        1. HDFS-8045-001.patch
          0.9 kB
          zhouyingchao

        Issue Links

          Activity

            People

              sinago zhouyingchao
              sinago zhouyingchao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: