Author: szetszwo Date: Fri Dec 28 00:58:24 2012 New Revision: 1426372 URL: http://svn.apache.org/viewvc?rev=1426372&view=rev Log: HDFS-4341. Set default data dir permission in MiniDFSClusterWithNodeGroup. Contributed by Ivan Mitic
Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/hdfs/MiniDFSClusterWithNodeGroup.java Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt?rev=1426372&r1=1426371&r2=1426372&view=diff ============================================================================== --- hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt (original) +++ hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt Fri Dec 28 00:58:24 2012 @@ -302,3 +302,6 @@ Branch-hadoop-1-win (branched from branc HDFS-4320. Add a separate configuration for namenode rpc address instead of using fs.default.name. (Mostafa Elhemali via suresh) + + HDFS-4341. Set default data dir permission in MiniDFSClusterWithNodeGroup. + (Ivan Mitic via szetszwo) Modified: hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/hdfs/MiniDFSClusterWithNodeGroup.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/hdfs/MiniDFSClusterWithNodeGroup.java?rev=1426372&r1=1426371&r2=1426372&view=diff ============================================================================== --- hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/hdfs/MiniDFSClusterWithNodeGroup.java (original) +++ hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/hdfs/MiniDFSClusterWithNodeGroup.java Fri Dec 28 00:58:24 2012 @@ -24,6 +24,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.FileUtil; +import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption; import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset; @@ -137,6 +139,16 @@ public class MiniDFSClusterWithNodeGroup throw new IOException("Mkdirs failed to create directory for DataNode " + i + ": " + dir1 + " or " + dir2); } + + // Set default permissions on data dirs as not all platforms have the + // same defaults + FileUtil.setPermission(dir1, new FsPermission( + conf.get("dfs.datanode.data.dir.perm", + DataNode.DEFAULT_DATA_DIR_PERMISSION))); + FileUtil.setPermission(dir2, new FsPermission( + conf.get("dfs.datanode.data.dir.perm", + DataNode.DEFAULT_DATA_DIR_PERMISSION))); + dnConf.set(DataNode.DATA_DIR_KEY, dir1.getPath() + "," + dir2.getPath()); } if (simulatedCapacities != null) {