[
https://issues.apache.org/jira/browse/YARN-11150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
lujie updated YARN-11150:
-------------------------
Description:
current, we implement
{code:java}
// private FSDataOutputStream createLogFileStream(FileSystem fileSystem,
Path logPathToCreate)
throws IOException {
FSDataOutputStream streamToCreate;
if (!isAppendSupported) {
logPathToCreate =
new Path(logPathToCreate.getParent(),
(logPathToCreate.getName() + "_" + Time.monotonicNow()));
}
if (!fileSystem.exists(logPathToCreate)) {
streamToCreate = fileSystem.create(logPathToCreate, false);
fileSystem.setPermission(logPathToCreate,
new FsPermission(FILE_LOG_PERMISSIONS));
} else {
streamToCreate = fileSystem.append(logPathToCreate);
}
return streamToCreate;
} {code}
but if node crash before setPermission, then the permission of log file will be
755 forever.
code should be like
{code:java}
// private FSDataOutputStream createLogFileStream(FileSystem fileSystem,
Path logPathToCreate)
throws IOException {
FSDataOutputStream streamToCreate;
if (!isAppendSupported) {
logPathToCreate =
new Path(logPathToCreate.getParent(),
(logPathToCreate.getName() + "_" + Time.monotonicNow()));
}
if (!fileSystem.exists(logPathToCreate)) {
streamToCreate = fileSystem.create(logPathToCreate, false);
fileSystem.setPermission(logPathToCreate,
new FsPermission(FILE_LOG_PERMISSIONS));
} else {
streamToCreate = fileSystem.append(logPathToCreate);
}
if
(!fileSystem.getStatus(logPathToCreate).getPermission().equals(FILE_LOG_PERMISSIONS))
{
fs.setPermission(dir, FILE_LOG_PERMISSIONS);
}
} {code}
was:
current, we implement
{code:java}
// private FSDataOutputStream createLogFileStream(FileSystem fileSystem,
Path logPathToCreate)
throws IOException {
FSDataOutputStream streamToCreate;
if (!isAppendSupported) {
logPathToCreate =
new Path(logPathToCreate.getParent(),
(logPathToCreate.getName() + "_" + Time.monotonicNow()));
}
if (!fileSystem.exists(logPathToCreate)) {
streamToCreate = fileSystem.create(logPathToCreate, false);
fileSystem.setPermission(logPathToCreate,
new FsPermission(FILE_LOG_PERMISSIONS));
} else {
streamToCreate = fileSystem.append(logPathToCreate);
}
return streamToCreate;
} {code}
but if node crash before setPermission, then the permission of log file will be
755 forever.
code should be like
{code:java}
// private FSDataOutputStream createLogFileStream(FileSystem fileSystem,
Path logPathToCreate)
throws IOException {
FSDataOutputStream streamToCreate;
if (!isAppendSupported) {
logPathToCreate =
new Path(logPathToCreate.getParent(),
(logPathToCreate.getName() + "_" + Time.monotonicNow()));
}
if (!fileSystem.exists(logPathToCreate)) {
streamToCreate = fileSystem.create(logPathToCreate, false);
fileSystem.setPermission(logPathToCreate,
new FsPermission(FILE_LOG_PERMISSIONS));
} else {
streamToCreate = fileSystem.append(logPathToCreate);
}
if
(!fileSystem.getStatus(logPathToCreate).getPermission().equals(FILE_LOG_PERMISSIONS))
{
fs.setPermission(dir, FILE_LOG_PERMISSIONS);
}
} {code}
> sensitive inform may leak due to crash
> --------------------------------------
>
> Key: YARN-11150
> URL: https://issues.apache.org/jira/browse/YARN-11150
> Project: Hadoop YARN
> Issue Type: Bug
> Reporter: lujie
> Priority: Major
>
> current, we implement
>
> {code:java}
> // private FSDataOutputStream createLogFileStream(FileSystem fileSystem,
> Path logPathToCreate)
> throws IOException {
> FSDataOutputStream streamToCreate;
> if (!isAppendSupported) {
> logPathToCreate =
> new Path(logPathToCreate.getParent(),
> (logPathToCreate.getName() + "_" + Time.monotonicNow()));
> }
> if (!fileSystem.exists(logPathToCreate)) {
> streamToCreate = fileSystem.create(logPathToCreate, false);
> fileSystem.setPermission(logPathToCreate,
> new FsPermission(FILE_LOG_PERMISSIONS));
> } else {
> streamToCreate = fileSystem.append(logPathToCreate);
> }
> return streamToCreate;
> } {code}
> but if node crash before setPermission, then the permission of log file will
> be 755 forever.
> code should be like
> {code:java}
> // private FSDataOutputStream createLogFileStream(FileSystem fileSystem,
> Path logPathToCreate)
> throws IOException {
> FSDataOutputStream streamToCreate;
> if (!isAppendSupported) {
> logPathToCreate =
> new Path(logPathToCreate.getParent(),
> (logPathToCreate.getName() + "_" + Time.monotonicNow()));
> }
> if (!fileSystem.exists(logPathToCreate)) {
> streamToCreate = fileSystem.create(logPathToCreate, false);
> fileSystem.setPermission(logPathToCreate,
> new FsPermission(FILE_LOG_PERMISSIONS));
> } else {
> streamToCreate = fileSystem.append(logPathToCreate);
> }
> if
> (!fileSystem.getStatus(logPathToCreate).getPermission().equals(FILE_LOG_PERMISSIONS))
> {
> fs.setPermission(dir, FILE_LOG_PERMISSIONS);
> }
> } {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]