|
@@ -74,6 +74,8 @@ public class DefaultContainerExecutor extends ContainerExecutor {
|
|
|
|
|
|
protected final FileContext lfs;
|
|
|
|
|
|
+ private String logDirPermissions = null;
|
|
|
+
|
|
|
public DefaultContainerExecutor() {
|
|
|
try {
|
|
|
this.lfs = FileContext.getLocalFSFileContext();
|
|
@@ -509,9 +511,6 @@ public class DefaultContainerExecutor extends ContainerExecutor {
|
|
|
/** Permissions for user app dir.
|
|
|
* $local.dir/usercache/$user/appcache/$appId */
|
|
|
static final short APPDIR_PERM = (short)0710;
|
|
|
- /** Permissions for user log dir.
|
|
|
- * $logdir/$user/$appId */
|
|
|
- static final short LOGDIR_PERM = (short)0710;
|
|
|
|
|
|
private long getDiskFreeSpace(Path base) throws IOException {
|
|
|
return lfs.getFsStatus(base).getRemaining();
|
|
@@ -702,7 +701,8 @@ public class DefaultContainerExecutor extends ContainerExecutor {
|
|
|
throws IOException {
|
|
|
|
|
|
boolean appLogDirStatus = false;
|
|
|
- FsPermission appLogDirPerms = new FsPermission(LOGDIR_PERM);
|
|
|
+ FsPermission appLogDirPerms = new
|
|
|
+ FsPermission(getLogDirPermissions());
|
|
|
for (String rootLogDir : logDirs) {
|
|
|
// create $log.dir/$appid
|
|
|
Path appLogDir = new Path(rootLogDir, appId);
|
|
@@ -727,7 +727,8 @@ public class DefaultContainerExecutor extends ContainerExecutor {
|
|
|
List<String> logDirs, String user) throws IOException {
|
|
|
|
|
|
boolean containerLogDirStatus = false;
|
|
|
- FsPermission containerLogDirPerms = new FsPermission(LOGDIR_PERM);
|
|
|
+ FsPermission containerLogDirPerms = new
|
|
|
+ FsPermission(getLogDirPermissions());
|
|
|
for (String rootLogDir : logDirs) {
|
|
|
// create $log.dir/$appid/$containerid
|
|
|
Path appLogDir = new Path(rootLogDir, appId);
|
|
@@ -749,6 +750,27 @@ public class DefaultContainerExecutor extends ContainerExecutor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Return default container log directory permissions.
|
|
|
+ */
|
|
|
+ @VisibleForTesting
|
|
|
+ public String getLogDirPermissions() {
|
|
|
+ if (this.logDirPermissions==null) {
|
|
|
+ this.logDirPermissions = getConf().get(
|
|
|
+ YarnConfiguration.NM_DEFAULT_CONTAINER_EXECUTOR_LOG_DIRS_PERMISSIONS,
|
|
|
+ YarnConfiguration.NM_DEFAULT_CONTAINER_EXECUTOR_LOG_DIRS_PERMISSIONS_DEFAULT);
|
|
|
+ }
|
|
|
+ return this.logDirPermissions;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Clear the internal variable for repeatable testing.
|
|
|
+ */
|
|
|
+ @VisibleForTesting
|
|
|
+ public void clearLogDirPermissions() {
|
|
|
+ this.logDirPermissions = null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return the list of paths of given local directories
|
|
|
*/
|