hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r957283 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java src/test/mapred/org/apache/hadoop/mapred/TestJobStatusPersistency.java
Date Wed, 23 Jun 2010 17:52:25 GMT
Author: acmurthy
Date: Wed Jun 23 17:52:25 2010
New Revision: 957283

URL: http://svn.apache.org/viewvc?rev=957283&view=rev
Log:
MAPREDUCE-1788. Ensure failure to setup CompletedJobStatusStore is not silently ignored by
the JobTracker. Contributed by Krishna Ramachandran.

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobStatusPersistency.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=957283&r1=957282&r2=957283&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Wed Jun 23 17:52:25 2010
@@ -64,6 +64,9 @@ Trunk (unreleased changes)
     MAPREDUCE-1868. Add a read and connection timeout to JobClient while
     pulling tasklogs. (Krishna Ramachandran via acmurthy)
 
+    MAPREDUCE-1788. Ensure failure to setup CompletedJobStatusStore is not
+    silently ignored by the JobTracker. (Krishna Ramachandran via acmurthy)
+
   OPTIMIZATIONS
 
     MAPREDUCE-1354. Enhancements to JobTracker for better performance and

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java?rev=957283&r1=957282&r2=957283&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java
(original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java
Wed Jun 23 17:52:25 2010
@@ -31,6 +31,9 @@ import org.apache.hadoop.mapreduce.JobAC
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.AccessControlException;
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.util.DiskChecker.DiskErrorException;
 
 /**
  * Persists and retrieves the Job info of a job into/from DFS.
@@ -56,6 +59,8 @@ class CompletedJobStatusStore implements
 
   private static long HOUR = 1000 * 60 * 60;
   private static long SLEEP_TIME = 1 * HOUR;
+  final static FsPermission JOB_STATUS_STORE_DIR_PERMISSION = FsPermission
+      .createImmutable((short) 0750); // rwxr-x--
 
   CompletedJobStatusStore(JobACLsManager aclsManager, Configuration conf)
       throws IOException {
@@ -74,12 +79,24 @@ class CompletedJobStatusStore implements
       // set the fs
       this.fs = path.getFileSystem(conf);
       if (!fs.exists(path)) {
-        if (!fs.mkdirs(path)) {
-          active = false;
-          LOG.warn("Couldn't create " + jobInfoDir
-              + ". CompletedJobStore will be inactive.");
-          return;
-        }
+        if (!fs.mkdirs(path, new FsPermission(JOB_STATUS_STORE_DIR_PERMISSION))) {
+          throw new IOException(
+              "CompletedJobStatusStore mkdirs failed to create "
+                  + path.toString());
+        }
+      } else {
+        FileStatus stat = fs.getFileStatus(path);
+        FsPermission actual = stat.getPermission();
+        if (!stat.isDir())
+          throw new DiskErrorException("not a directory: " 
+                                   + path.toString());
+        FsAction user = actual.getUserAction();
+        if (!user.implies(FsAction.READ))
+          throw new DiskErrorException("directory is not readable: "
+                                   + path.toString());
+        if (!user.implies(FsAction.WRITE))
+          throw new DiskErrorException("directory is not writable: "
+                                   + path.toString());
       }
 
       if (retainTime == 0) {

Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobStatusPersistency.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobStatusPersistency.java?rev=957283&r1=957282&r2=957283&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobStatusPersistency.java
(original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobStatusPersistency.java
Wed Jun 23 17:52:25 2010
@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.io.IOException;
 import java.util.Properties;
 
 import org.apache.hadoop.fs.FileSystem;
@@ -169,15 +170,16 @@ public class TestJobStatusPersistency ex
       config.set(JTConfig.JT_PERSIST_JOBSTATUS_HOURS, "1");
       config.set(JTConfig.JT_PERSIST_JOBSTATUS_DIR, new Path(parent,
           "child").toUri().getPath());
-      mr = new MiniMRCluster(0, "file:///", 4, null, null, config);
-      assertFalse(
-          "CompletedJobStore is unexpectly active!",
-          mr.getJobTrackerRunner().getJobTracker().completedJobStatusStore.isActive());
+      boolean started = true;
+      JobConf conf = MiniMRCluster.configureJobConf(config, "file:///", 0, 0, null);
+      try {
+        JobTracker jt = JobTracker.startTracker(conf);
+      } catch (IOException ex) {
+        started = false;
+      }
+      assertFalse(started);
     } finally {
       new File(parent.toUri().getPath()).setWritable(true, false);
-      if (mr != null) {
-        mr.shutdown();
-      }
     }
   }
 }



Mime
View raw message