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

Refine fs operations in FileSystemRMStateStore and few fixes

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.0
    • Component/s: resourcemanager
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: