hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r722913 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java src/mapred/org/apache/hadoop/mapred/JobTracker.java
Date Wed, 03 Dec 2008 14:54:15 GMT
Author: tomwhite
Date: Wed Dec  3 06:54:15 2008
New Revision: 722913

URL: http://svn.apache.org/viewvc?rev=722913&view=rev
Log:
HADOOP-4420. Add null checks for job, caused by invalid job IDs. Contributed by Aaron Kimball.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=722913&r1=722912&r2=722913&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Dec  3 06:54:15 2008
@@ -244,6 +244,9 @@
     HADOOP-4732. Pass connection and read timeouts in the correct order when
     setting up fetch in reduce. (Amareshwari Sriramadasu via cdouglas)
 
+    HADOOP-4420. Add null checks for job, caused by invalid job IDs.
+    (Aaron Kimball via tomwhite)
+
 Release 0.19.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java?rev=722913&r1=722912&r2=722913&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/CompletedJobStatusStore.java Wed
Dec  3 06:54:15 2008
@@ -219,6 +219,12 @@
    */
   public JobStatus readJobStatus(JobID jobId) {
     JobStatus jobStatus = null;
+    
+    if (null == jobId) {
+      LOG.warn("Could not read job status for null jobId");
+      return null;
+    }
+    
     if (active) {
       try {
         FSDataInputStream dataIn = getJobInfoFile(jobId);

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java?rev=722913&r1=722912&r2=722913&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java Wed Dec  3 06:54:15
2008
@@ -2292,7 +2292,18 @@
   }
     
   public synchronized void killJob(JobID jobid) throws IOException {
+    if (null == jobid) {
+      LOG.info("Null jobid object sent to JobTracker.killJob()");
+      return;
+    }
+    
     JobInProgress job = jobs.get(jobid);
+    
+    if (null == job) {
+      LOG.info("killJob(): JobId " + jobid.toString() + " is not a valid job");
+      return;
+    }
+        
     JobStatus prevStatus = (JobStatus)job.getStatus().clone();
     checkAccess(job, QueueManager.QueueOperation.ADMINISTER_JOBS);
     job.kill();
@@ -2322,6 +2333,11 @@
                                               String priority)
                                                 throws IOException {
     JobInProgress job = jobs.get(jobid);
+    if (null == job) {
+        LOG.info("setJobPriority(): JobId " + jobid.toString()
+            + " is not a valid job");
+        return;
+    }
     checkAccess(job, QueueManager.QueueOperation.ADMINISTER_JOBS);
     JobPriority newPriority = JobPriority.valueOf(priority);
     setJobPriority(jobid, newPriority);
@@ -2336,6 +2352,11 @@
     }
   }
   public synchronized JobStatus getJobStatus(JobID jobid) {
+    if (null == jobid) {
+      LOG.warn("JobTracker.getJobStatus() cannot get status for null jobid");
+      return null;
+    }
+    
     JobInProgress job = jobs.get(jobid);
     if (job != null) {
       return job.getStatus();



Mime
View raw message