hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r583424 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/JobTracker.java src/webapps/job/jobdetails.jsp
Date Wed, 10 Oct 2007 10:48:21 GMT
Author: ddas
Date: Wed Oct 10 03:48:15 2007
New Revision: 583424

URL: http://svn.apache.org/viewvc?rev=583424&view=rev
Log:
HADOOP-2001.  Make the job priority updates and job kills synchronized on the JobTracker.
Deadlock was seen in the JobTracker because of the lack of this synchronization. Contributed
by Arun C Murthy

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=583424&r1=583423&r2=583424&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Oct 10 03:48:15 2007
@@ -259,6 +259,10 @@
     otherwise may lead to lost tasktrackers if the NameNode is unresponsive.
     (Devaraj Das via acmurthy)
 
+    HADOOP-2001.  Make the job priority updates and job kills synchronized on
+    the JobTracker. Deadlock was seen in the JobTracker because of the lack of
+    this synchronization.  (Arun C Murthy via ddas)
+
   IMPROVEMENTS
 
     HADOOP-1908. Restructure data node code so that block sending and 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=583424&r1=583423&r2=583424&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Wed Oct 10 03:48:15
2007
@@ -1545,7 +1545,7 @@
   /**
    * Sort jobs by priority and then by start time.
    */
-  public void resortPriority() {
+  private synchronized void resortPriority() {
     Comparator<JobInProgress> comp = new Comparator<JobInProgress>() {
       public int compare(JobInProgress o1, JobInProgress o2) {
         int res = o1.getPriority().compareTo(o2.getPriority());
@@ -1761,6 +1761,23 @@
     return jobs.get(jobid);
   }
 
+  /**
+   * Change the run-time priority of the given job.
+   * @param jobId job id
+   * @param priority new {@link JobPriority} for the job
+   */
+  synchronized void setJobPriority(String jobId, JobPriority priority) {
+    JobInProgress job = jobs.get(jobId);
+    if (job != null) {
+      job.setPriority(priority);
+      
+      // Re-sort jobs to reflect this change
+      resortPriority();
+    } else {
+      LOG.warn("Trying to change the priority of an unknown job: " + jobId);
+    }
+  }
+  
   ////////////////////////////////////////////////////
   // Methods to track all the TaskTrackers
   ////////////////////////////////////////////////////

Modified: lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp?rev=583424&r1=583423&r2=583424&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp Wed Oct 10 03:48:15 2007
@@ -105,8 +105,8 @@
     
     String action = request.getParameter("action");
     if("changeprio".equalsIgnoreCase(action)) {
-	  job.setPriority(JobPriority.valueOf(request.getParameter("prio")));
-	  tracker.resortPriority();
+      tracker.setJobPriority(jobId, 
+                             JobPriority.valueOf(request.getParameter("prio")));
     }
     
     if(JspHelper.conf.getBoolean(PRIVATE_ACTIONS_KEY, false)) {
@@ -115,8 +115,8 @@
   	      printConfirm(out, jobId);
     	    return;
 	    }
-  	  else if(action != null && action.equalsIgnoreCase("kill")) {
-				job.kill();
+  	    else if(action != null && action.equalsIgnoreCase("kill")) {
+	      tracker.killJob(jobId);
 	    }
     }
 %>



Mime
View raw message