Browse Source

Merge -r 752912:752913 from trunk to branch 0.20 to fix HADOOP-5395.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20@752914 13f79535-47bb-0310-9956-ffa450edef68
Hemanth Yamijala 16 years ago
parent
commit
99bd46c9d6

+ 3 - 0
CHANGES.txt

@@ -697,6 +697,9 @@ Release 0.20.0 - Unreleased
     ACL check failures and also check ACLs on restart.
     (Amar Kamat via yhemanth)
 
+    HADOOP-5395. Change the exception message when a job is submitted to an
+    invalid queue. (Rahul Kumar Singh via yhemanth)
+
 Release 0.19.2 - Unreleased
 
   BUG FIXES

+ 6 - 0
src/mapred/org/apache/hadoop/mapred/JobTracker.java

@@ -2775,6 +2775,12 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
     }
     
     JobInProgress job = new JobInProgress(jobId, this, this.conf);
+    
+    String queue = job.getProfile().getQueueName();
+    if(!(queueManager.getQueues().contains(queue))) {      
+      new CleanupQueue().addToQueue(conf,getSystemDirectoryForJob(jobId));
+      throw new IOException("Queue \"" + queue + "\" does not exist");        
+    }
 
     // check for access
     try {

+ 16 - 0
src/test/org/apache/hadoop/mapred/TestQueueManager.java

@@ -101,6 +101,22 @@ public class TestQueueManager extends TestCase {
     verifyJobSubmission(conf, false, "q1");
   }
   
+  public void testSubmissionToInvalidQueue() throws IOException{
+    JobConf conf = new JobConf();
+    conf.set("mapred.queue.names","default");
+    setUpCluster(conf);
+    String queueName = "q1";
+    try {
+      RunningJob rjob = submitSleepJob(1, 1, 100, 100, true, null, queueName);
+    } catch (IOException ioe) {      
+       assertTrue(ioe.getMessage().contains("Queue \"" + queueName + "\" does not exist"));
+       return;
+    } finally {
+      tearDownCluster();
+    }
+    fail("Job submission to invalid queue job shouldnot complete , it should fail with proper exception ");   
+  }
+  
   public void testEnabledACLForNonDefaultQueue() throws IOException,
                                                           LoginException {
     // login as self...