소스 검색

Merge -r 1150527:1150528 from branch-0.20-security onto branch-0.20-security-204

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-204@1150857 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 13 년 전
부모
커밋
f4ce7e4fe3

+ 3 - 0
CHANGES.txt

@@ -1,5 +1,8 @@
 Hadoop Change Log
 
+    MAPREDUCE-2621. TestCapacityScheduler fails with "Queue "q1" does not exist".
+    (Sherry Chen via mahadev)
+
 Release 0.20.204.0 - unreleased
 
   NEW FEATURES

+ 1 - 1
src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/TestCapacityScheduler.java

@@ -794,7 +794,7 @@ public class TestCapacityScheduler extends TestCase {
     FakeJobInProgress job =
         new FakeJobInProgress(new JobID("test", ++jobCounter),
             (jobConf == null ? new JobConf(conf) : jobConf), taskTrackerManager,
-            jobConf.getUser(), UtilsForTests.getJobTracker());
+            jobConf.getUser(), UtilsForTests.getJobTracker(taskTrackerManager.getQueueManager()));
     job.getStatus().setRunState(state);
     taskTrackerManager.submitJob(job);
     return job;

+ 13 - 5
src/mapred/org/apache/hadoop/mapred/JobTracker.java

@@ -2165,6 +2165,11 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
     this(conf, generateNewIdentifier());
   }
 
+  JobTracker(JobConf conf, QueueManager qm) 
+  throws IOException, InterruptedException {
+    this(conf, generateNewIdentifier(), new Clock(), qm);
+  }
+
   JobTracker(JobConf conf, Clock clock) 
   throws IOException, InterruptedException {
     this(conf, generateNewIdentifier(), clock);
@@ -2178,9 +2183,16 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
   throws IOException, InterruptedException {   
     this(conf, identifier, new Clock());
   }
-  
+
   JobTracker(final JobConf conf, String identifier, Clock clock) 
   throws IOException, InterruptedException { 
+
+    this(conf, identifier, clock, new QueueManager(new Configuration(conf)));
+  } 
+  
+  JobTracker(final JobConf conf, String identifier, Clock clock, QueueManager qm) 
+  throws IOException, InterruptedException { 
+    this.queueManager = qm;
     this.clock = clock;
     // Set ports, start RPC servers, setup security policy etc.
     InetSocketAddress addr = getAddress(conf);
@@ -2271,10 +2283,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
     // Read the hosts/exclude files to restrict access to the jobtracker.
     this.hostsReader = new HostsFileReader(conf.get("mapred.hosts", ""),
                                            conf.get("mapred.hosts.exclude", ""));
-
-    Configuration queuesConf = new Configuration(this.conf);
-    queueManager = new QueueManager(queuesConf);
-
     aclsManager = new ACLsManager(conf, new JobACLsManager(conf), queueManager);
 
     LOG.info("Starting jobtracker with owner as " +

+ 9 - 1
src/test/org/apache/hadoop/mapred/UtilsForTests.java

@@ -825,12 +825,20 @@ public class UtilsForTests {
   }
 
   static JobTracker getJobTracker() {
+    return(getJobTracker(null));
+  }
+
+  static JobTracker getJobTracker(QueueManager qm) {
     JobConf conf = new JobConf();
     conf.set("mapred.job.tracker", "localhost:0");
     conf.set("mapred.job.tracker.http.address", "0.0.0.0:0");
     JobTracker jt;
     try {
-      jt = new JobTracker(conf);
+      if (qm == null) {
+       jt = new JobTracker(conf);
+      } else {
+        jt = new JobTracker(conf, qm);
+      }
       return jt;
     } catch (Exception e) {
       throw new RuntimeException("Could not start jt", e);