You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by to...@apache.org on 2010/11/10 22:25:19 UTC
svn commit: r1033720 - in /hadoop/mapreduce/trunk: CHANGES.txt
src/java/org/apache/hadoop/mapreduce/filecache/TrackerDistributedCacheManager.java
src/test/mapred/org/apache/hadoop/mapreduce/filecache/TestTrackerDistributedCacheManager.java
Author: tomwhite
Date: Wed Nov 10 21:25:19 2010
New Revision: 1033720
URL: http://svn.apache.org/viewvc?rev=1033720&view=rev
Log:
MAPREDUCE-2073. TestTrackerDistributedCacheManager should be up-front about requirements on build environment. Contributed by Todd Lipcon.
Modified:
hadoop/mapreduce/trunk/CHANGES.txt
hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/filecache/TrackerDistributedCacheManager.java
hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/filecache/TestTrackerDistributedCacheManager.java
Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=1033720&r1=1033719&r2=1033720&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Wed Nov 10 21:25:19 2010
@@ -161,6 +161,9 @@ Trunk (unreleased changes)
MAPREDUCE-1592. Generate Eclipse's .classpath file from Ivy config.
(tomwhite via nigel)
+ MAPREDUCE-2073. TestTrackerDistributedCacheManager should be up-front
+ about requirements on build environment. (Todd Lipcon via tomwhite)
+
OPTIMIZATIONS
MAPREDUCE-1354. Enhancements to JobTracker for better performance and
Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/filecache/TrackerDistributedCacheManager.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/filecache/TrackerDistributedCacheManager.java?rev=1033720&r1=1033719&r2=1033720&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/filecache/TrackerDistributedCacheManager.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/filecache/TrackerDistributedCacheManager.java Wed Nov 10 21:25:19 2010
@@ -359,7 +359,17 @@ public class TrackerDistributedCacheMana
if (!checkPermissionOfOther(fs, current, FsAction.READ)) {
return false;
}
- current = current.getParent();
+ return ancestorsHaveExecutePermissions(fs, current.getParent());
+ }
+
+ /**
+ * Returns true if all ancestors of the specified path have the 'execute'
+ * permission set for all users (i.e. that other users can traverse
+ * the directory heirarchy to the given path)
+ */
+ static boolean ancestorsHaveExecutePermissions(FileSystem fs, Path path)
+ throws IOException {
+ Path current = path;
while (current != null) {
//the subdirs in the path should have execute permissions for others
if (!checkPermissionOfOther(fs, current, FsAction.EXECUTE)) {
@@ -369,6 +379,7 @@ public class TrackerDistributedCacheMana
}
return true;
}
+
/**
* Checks for a given path whether the Other permissions on it
* imply the permission in the passed FsAction
Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/filecache/TestTrackerDistributedCacheManager.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/filecache/TestTrackerDistributedCacheManager.java?rev=1033720&r1=1033719&r2=1033720&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/filecache/TestTrackerDistributedCacheManager.java (original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/filecache/TestTrackerDistributedCacheManager.java Wed Nov 10 21:25:19 2010
@@ -87,6 +87,19 @@ public class TestTrackerDistributedCache
TEST_ROOT.mkdirs();
}
+ conf = new Configuration();
+ conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
+ fs = FileSystem.get(conf);
+
+ // This test suite will fail if any ancestor directory of the
+ // test directory is not world-searchable (ie +x).
+ // We prefer to fail the test in an obvious manner up front
+ // during setUp() rather than in a subtle way later.
+ assertTrue("Test root directory " + TEST_ROOT + " and all of its " +
+ "parent directories must have a+x permissions",
+ TrackerDistributedCacheManager.ancestorsHaveExecutePermissions(
+ fs, new Path(TEST_ROOT.toString())));
+
// Prepare the tests' mapred-local-dir
ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
ROOT_MAPRED_LOCAL_DIR.mkdirs();
@@ -98,10 +111,7 @@ public class TestTrackerDistributedCache
localDir.mkdir();
}
- conf = new Configuration();
conf.setStrings(MRConfig.LOCAL_DIR, localDirs);
- conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
- fs = FileSystem.get(conf);
Class<? extends TaskController> taskControllerClass = conf.getClass(
TTConfig.TT_TASK_CONTROLLER, DefaultTaskController.class,
TaskController.class);