hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject svn commit: r1328292 - in /hadoop/common/branches/branch-1: ./ src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/ src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/ src/webapps/job/
Date Fri, 20 Apr 2012 10:02:21 GMT
Author: harsh
Date: Fri Apr 20 10:02:21 2012
New Revision: 1328292

URL: http://svn.apache.org/viewvc?rev=1328292&view=rev
Log:
MAPREDUCE-3674. Invoked with no queueName request param, the jobqueue_details.jsp injects
a null queue name into schedulers. (harsh)


Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java
    hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/Pool.java
    hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerPoolNames.java
    hadoop/common/branches/branch-1/src/webapps/job/jobqueue_details.jsp

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1328292&r1=1328291&r2=1328292&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Fri Apr 20 10:02:21 2012
@@ -225,6 +225,9 @@ Release 1.1.0 - unreleased
     MAPREDUCE-4154. streaming MR job succeeds even if the streaming command 
     fails. (Devaraj Das via tgraves)
 
+    MAPREDUCE-3674. Invoked with no queueName request param, the
+    jobqueue_details.jsp injects a null queue name into schedulers. (harsh)
+
 Release 1.0.3 - unreleased
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java?rev=1328292&r1=1328291&r2=1328292&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java
(original)
+++ hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java
Fri Apr 20 10:02:21 2012
@@ -1020,6 +1020,9 @@ public class FairScheduler extends TaskS
 
   @Override
   public synchronized Collection<JobInProgress> getJobs(String queueName) {
+    if (queueName == null) {
+      return null;
+    }
     Pool myJobPool = poolMgr.getPool(queueName);
     return myJobPool.getJobs();
   }

Modified: hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/Pool.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/Pool.java?rev=1328292&r1=1328291&r2=1328292&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/Pool.java
(original)
+++ hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/Pool.java
Fri Apr 20 10:02:21 2012
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.hadoop.mapreduce.TaskType;
-import org.apache.hadoop.metrics.MetricsContext;
 
 /**
  * A schedulable pool of jobs.
@@ -44,6 +43,9 @@ public class Pool {
   private PoolSchedulable reduceSchedulable;
 
   public Pool(FairScheduler scheduler, String name) {
+    if (name == null) {
+      throw new IllegalArgumentException("Passed pool name was null.");
+    }
     this.name = name;
     mapSchedulable = new PoolSchedulable(scheduler, this, TaskType.MAP);
     reduceSchedulable = new PoolSchedulable(scheduler, this, TaskType.REDUCE);

Modified: hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerPoolNames.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerPoolNames.java?rev=1328292&r1=1328291&r2=1328292&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerPoolNames.java
(original)
+++ hadoop/common/branches/branch-1/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerPoolNames.java
Fri Apr 20 10:02:21 2012
@@ -32,6 +32,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapred.Pool;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -175,4 +176,18 @@ public class TestFairSchedulerPoolNames 
         "Add pool name to the fair scheduler allocation file"));
   }
 
-}
\ No newline at end of file
+  /**
+   * Tests that no Pool object can be created with a null string.
+   */
+  @Test
+  public void testPoolNameNotNull() {
+    try {
+      Pool pool = new Pool(null, null);
+      fail("Pool object got created with a null name somehow.");
+    } catch (IllegalArgumentException e) {
+      // Pass
+    } catch (Exception e) {
+      fail("Pool object got created with a null name and failed only later.");
+    }
+  }
+}

Modified: hadoop/common/branches/branch-1/src/webapps/job/jobqueue_details.jsp
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/webapps/job/jobqueue_details.jsp?rev=1328292&r1=1328291&r2=1328292&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/webapps/job/jobqueue_details.jsp (original)
+++ hadoop/common/branches/branch-1/src/webapps/job/jobqueue_details.jsp Fri Apr 20 10:02:21
2012
@@ -25,7 +25,7 @@ private static final long serialVersionU
 <html>
 <head>
 <title>Queue details for
-<%=queueName!=null?queueName:""%> </title>
+<%=queueName!=null?queueName:"(Given queue name was 'null')"%> </title>
 <link rel="stylesheet" type="text/css" href="/static/hadoop.css">
 <script type="text/javascript" src="/static/jobtracker.js"></script>
 </head>



Mime
View raw message