Uploaded image for project: 'Apache Tez'
  1. Apache Tez
  2. TEZ-4413

Fix permission may not be set after crash

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.10.5
    • None
    • None

    Description

      the code  in createDirIfNotExists:

       

       

        private void createDirIfNotExists(Path path) throws IOException {
          FileSystem fileSystem = path.getFileSystem(conf);
          try {
            if (!fileSystem.exists(path)) {
              fileSystem.mkdirs(path);
              fileSystem.setPermission(path, DIR_PERMISSION);
            }
          } catch (IOException e) {
            // Ignore this exception, if there is a problem it'll fail when trying to read or write.
            LOG.warn("Error while trying to set permission: ", e);
          }
        }

       

      but if the node crash between mkdirs and setPermission, the permisson will not be set forever even reboot.

       

      So how about change the code like 

       

       

        private void createDirIfNotExists(Path path) throws IOException {
          FileSystem fileSystem = path.getFileSystem(conf);
          try {
            if (!fileSystem.exists(path)) {
              fileSystem.mkdirs(path);
             
            }
               fileSystem.setPermission(path, DIR_PERMISSION);
           } catch (IOException e) {
            // Ignore this exception, if there is a problem it'll fail when trying to read or write.
            LOG.warn("Error while trying to set permission: ", e);
          }
        } 

       

       

       

      Attachments

        Activity

          People

            ayushtkn Ayush Saxena
            xiaoheipangzi lujie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 50m
                1h 50m