Hadoop Common
  1. Hadoop Common
  2. HADOOP-2423

The codes in FSDirectory.mkdirs(...) is inefficient.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.15.1
    • Fix Version/s: 0.17.0
    • Component/s: None
    • Labels:
      None
    • Release Note:
      Improved FSDirectory.mkdirs(...) performance. In NNThroughputBenchmark-create, the ops per sec in was improved ~54%.

      Description

      FSDirectory.mkdirs(...) creates List<String> v to store all dirs. e.g.

      //Suppose 
      src = "/foo/bar/bas/"
      //Then,
      v = {"/", "/foo", "/foo/bar", "/foo/bar/bas"}
      

      For each directory string cur in v, no matter cur already exists or not, it will try to do a unprotectedMkdir(cur, ...). Then, cur is parsed to byte[][] in INodeDirectory.addNode (...).

      We don't need to do the parsing for each string in v. Instead, byte[][] should be stored. Also, the loop should not continue once it finds an existing subdirectory.

      1. 2423_20080311.patch
        7 kB
        Tsz Wo Nicholas Sze
      2. 2423_20080310.patch
        7 kB
        Tsz Wo Nicholas Sze
      3. 2423_20080304d.patch
        8 kB
        Tsz Wo Nicholas Sze
      4. 2423_20080304c.patch
        8 kB
        Tsz Wo Nicholas Sze
      5. 2423_20080304b.patch
        8 kB
        Tsz Wo Nicholas Sze
      6. 2423_20080304.patch
        5 kB
        Tsz Wo Nicholas Sze
      7. 2423_20080303.patch
        13 kB
        Tsz Wo Nicholas Sze
      8. 2423_20080130.patch
        14 kB
        Tsz Wo Nicholas Sze

        Issue Links

          Activity

          Tsz Wo Nicholas Sze created issue -
          Tsz Wo Nicholas Sze made changes -
          Field Original Value New Value
          Description FSDirectory.mkdirs(...) creates a list of string storing all FSDirectory.mkdirs(...) creates List<String> v to store all dirs. e.g.

          {code}
          //Suppose
          src = "/foo/bar/bas/"
          //Then,
          v = {"/", "/foo", "/foo/bar", "/foo/bar/bas"}
          {code}

          For each directory string *cur* in v, no matter *cur* already exists or not, it will try to do a unprotectedMkdir(cur, ...). Then, *cur* is parsed to byte[][] in INodeDirectory.addNode (...).

          We don't need to do the parsing for each string in v. Instead, byte[][] should be stored. Also, the loop should not continue once it finds an existing subdirectory.
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080130.patch [ 12374425 ]
          Tsz Wo Nicholas Sze made changes -
          Assignee Tsz Wo (Nicholas), SZE [ szetszwo ]
          Tsz Wo Nicholas Sze made changes -
          Link This issue relates to HADOOP-2002 [ HADOOP-2002 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080303.patch [ 12376996 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080304.patch [ 12377099 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080304b.patch [ 12377108 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080304c.patch [ 12377116 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080304d.patch [ 12377125 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080310.patch [ 12377563 ]
          Tsz Wo Nicholas Sze made changes -
          Attachment 2423_20080311.patch [ 12377629 ]
          Tsz Wo Nicholas Sze made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          dhruba borthakur made changes -
          Resolution Fixed [ 1 ]
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Fix Version/s 0.17.0 [ 12312913 ]
          Tsz Wo Nicholas Sze made changes -
          Release Note Improved FSDirectory.mkdirs(...) performance. In NNThroughputBenchmark-create, the ops per sec in was improved ~54%.
          Nigel Daley made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Owen O'Malley made changes -
          Component/s dfs [ 12310710 ]
          Tsz Wo Nicholas Sze made changes -
          Link This issue is related to HDFS-1832 [ HDFS-1832 ]

            People

            • Assignee:
              Tsz Wo Nicholas Sze
              Reporter:
              Tsz Wo Nicholas Sze
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development