Zhang Dongsheng created STORM-3888:
--------------------------------------
Summary: HdfsBlobStoreFile set wrong permission for file
Key: STORM-3888
URL: https://issues.apache.org/jira/browse/STORM-3888
Project: Apache Storm
Issue Type: Improvement
Components: blobstore
Reporter: Zhang Dongsheng
{code:java}
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());
}
......
}
{code}
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
{code:java}
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());
}
......
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)