Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-3888

HdfsBlobStoreFile set wrong permission for file

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 2.6.0
    • blobstore
    • None

    Description

          public OutputStream getOutputStream() throws IOException {
              FsPermission fileperms = new FsPermission(BLOBSTORE_FILE_PERMISSION);
              try {
                  out = fileSystem.create(path, (short) this.getMetadata().get_replication_factor());
                  fileSystem.setPermission(path, fileperms);
                  fileSystem.setReplication(path, (short) this.getMetadata().get_replication_factor());
              } catch (IOException e) {
                 ......
                  out = fileSystem.create(path, (short) this.getMetadata().get_replication_factor());
                  fileSystem.setPermission(path, dirperms);
                  fileSystem.setReplication(path, (short) this.getMetadata().get_replication_factor());
              }
              ......
          }
      

      We can see that there are permission settings for path in both try and catch, but the permission in catch is different from that in try. In catch, the permission `dirperms` is given to the file. I think there is a problem here, and it should be the same as The permissions in try are consistent.

      Permissions should be set according to the following code

          public OutputStream getOutputStream() throws IOException {
              FsPermission fileperms = new FsPermission(BLOBSTORE_FILE_PERMISSION);
              try {
                  out = fileSystem.create(path, (short) this.getMetadata().get_replication_factor());
                  fileSystem.setPermission(path, fileperms);
                  fileSystem.setReplication(path, (short) this.getMetadata().get_replication_factor());
              } catch (IOException e) {
                 ......
                  out = fileSystem.create(path, (short) this.getMetadata().get_replication_factor());
                  fileSystem.setPermission(path, fileperms);
                  fileSystem.setReplication(path, (short) this.getMetadata().get_replication_factor());
              }
              ......
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            skysider Zhang Dongsheng
            Votes:
            0 Vote for this issue
            Watchers:
            1 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 - 40m
                40m