Browse Source

HADOOP-9656. Merging change r1496600 from branch-2 to branch-2.1-beta.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1-beta@1496602 13f79535-47bb-0310-9956-ffa450edef68
Chris Nauroth 12 năm trước cách đây
mục cha
commit
f3aede1116

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -259,6 +259,9 @@ Release 2.1.0-beta - UNRELEASED
     HADOOP-9439.  JniBasedUnixGroupsMapping: fix some crash bugs. (Colin
     Patrick McCabe)
 
+    HADOOP-9656. Gridmix unit tests fail on Windows and Linux. (Chuan Liu via
+    cnauroth)
+
   BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
 
     HADOOP-8924. Hadoop Common creating package-info.java must not depend on

+ 10 - 8
hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GenerateDistCacheData.java

@@ -86,6 +86,15 @@ class GenerateDistCacheData extends GridmixJob {
       "gridmix.distcache.file.list";
   static final String JOB_NAME = "GRIDMIX_GENERATE_DISTCACHE_DATA";
 
+  /**
+   * Create distributed cache file with the permissions 0644.
+   * Since the private distributed cache directory doesn't have execute
+   * permission for others, it is OK to set read permission for others for
+   * the files under that directory and still they will become 'private'
+   * distributed cache files on the simulated cluster.
+   */
+  static final short GRIDMIX_DISTCACHE_FILE_PERM = 0644;
+
   public GenerateDistCacheData(Configuration conf) throws IOException {
     super(conf, 0L, JOB_NAME);
   }
@@ -146,15 +155,8 @@ class GenerateDistCacheData extends GridmixJob {
       String fileName = new String(value.getBytes(), 0, value.getLength());
       Path path = new Path(fileName);
 
-      /**
-       * Create distributed cache file with the permissions 0755.
-       * Since the private distributed cache directory doesn't have execute
-       * permission for others, it is OK to set read permission for others for
-       * the files under that directory and still they will become 'private'
-       * distributed cache files on the simulated cluster.
-       */
       FSDataOutputStream dos =
-          FileSystem.create(fs, path, new FsPermission((short)0755));
+          FileSystem.create(fs, path, new FsPermission(GRIDMIX_DISTCACHE_FILE_PERM));
 
       int size = 0;
       for (long bytes = key.get(); bytes > 0; bytes -= size) {

+ 2 - 2
hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/GridmixJob.java

@@ -311,7 +311,7 @@ abstract class GridmixJob implements Callable<Job>, Delayed {
     // set the memory per map task
     scaleConfigParameter(sourceConf, destConf, 
                          MRConfig.MAPMEMORY_MB, MRJobConfig.MAP_MEMORY_MB, 
-                         JobConf.DISABLED_MEMORY_LIMIT);
+                         MRJobConfig.DEFAULT_MAP_MEMORY_MB);
     
     // validate and fail early
     validateTaskMemoryLimits(destConf, MRJobConfig.MAP_MEMORY_MB, 
@@ -320,7 +320,7 @@ abstract class GridmixJob implements Callable<Job>, Delayed {
     // set the memory per reduce task
     scaleConfigParameter(sourceConf, destConf, 
                          MRConfig.REDUCEMEMORY_MB, MRJobConfig.REDUCE_MEMORY_MB,
-                         JobConf.DISABLED_MEMORY_LIMIT);
+                         MRJobConfig.DEFAULT_REDUCE_MEMORY_MB);
     // validate and fail early
     validateTaskMemoryLimits(destConf, MRJobConfig.REDUCE_MEMORY_MB, 
                              JTConfig.JT_MAX_REDUCEMEMORY_MB);

+ 2 - 1
hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/CommonJobTest.java

@@ -327,7 +327,8 @@ public class CommonJobTest {
     final Path out = GridmixTestUtils.DEST.makeQualified(
             GridmixTestUtils.dfs.getUri(),
             GridmixTestUtils.dfs.getWorkingDirectory());
-    final Path root = new Path(workspace.getAbsolutePath());
+    final Path root = new Path(workspace.getName()).makeQualified(
+        GridmixTestUtils.dfs.getUri(), GridmixTestUtils.dfs.getWorkingDirectory());
     if (!workspace.exists()) {
       assertTrue(workspace.mkdirs());
     }

+ 2 - 2
hadoop-tools/hadoop-gridmix/src/test/java/org/apache/hadoop/mapred/gridmix/TestDistCacheEmulation.java

@@ -134,8 +134,8 @@ public class TestDistCacheEmulation {
 
       FsPermission perm = stat.getPermission();
       assertEquals("Wrong permissions for distributed cache file "
-          + stat.getPath().toUri().getPath(), new FsPermission((short) 0644),
-          perm);
+          + stat.getPath().toUri().getPath(), new FsPermission(
+          GenerateDistCacheData.GRIDMIX_DISTCACHE_FILE_PERM), perm);
     }
   }