Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-2996

Refine fs operations in FileSystemRMStateStore and few fixes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.7.0
    • resourcemanager
    • None
    • Reviewed

    Description

      In FileSystemRMStateStore, we can refine some fs operations to improve performance:
      1. There are several places invoke fs.exists, then fs.getFileStatus, we can merge them to save one RPC call

      if (fs.exists(versionNodePath)) {
          FileStatus status = fs.getFileStatus(versionNodePath);
      

      2.

      protected void updateFile(Path outputPath, byte[] data) throws Exception {
        Path newPath = new Path(outputPath.getParent(), outputPath.getName() + ".new");
        // use writeFile to make sure .new file is created atomically
        writeFile(newPath, data);
        replaceFile(newPath, outputPath);
      }
      

      The updateFile is not good too, it write file to output_file.tmp, then rename to output_file.new, then rename it to output_file, we can reduce one rename operation.

      Also there is one unnecessary import, we can remove it.

      Attachments

        1. YARN-2996.001.patch
          4 kB
          Yi Liu
        2. YARN-2996.002.patch
          5 kB
          Yi Liu
        3. YARN-2996.003.patch
          5 kB
          Yi Liu
        4. YARN-2996.004.patch
          6 kB
          Yi Liu

        Issue Links

          Activity

            People

              hitliuyi Yi Liu
              hitliuyi Yi Liu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: