hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r663829 - in /hadoop/core/trunk: ./ src/java/org/apache/hadoop/mapred/ src/java/org/apache/hadoop/util/
Date Fri, 06 Jun 2008 05:40:22 GMT
Author: ddas
Date: Thu Jun  5 22:40:21 2008
New Revision: 663829

URL: http://svn.apache.org/viewvc?rev=663829&view=rev
Log:
HADOOP-236. JobTacker now refuses connection from a task tracker with a different version
number. Contributed by Sharad Agarwal.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/InterTrackerProtocol.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
    hadoop/core/trunk/src/java/org/apache/hadoop/util/VersionInfo.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=663829&r1=663828&r2=663829&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Jun  5 22:40:21 2008
@@ -235,6 +235,10 @@
       deprecated mapred.map.output.compression.type 
     (acmurthy)
 
+    HADOOP-236. JobTacker now refuses connection from a task tracker with a 
+    different version number. (Sharad Agarwal via ddas)
+
+
   OPTIMIZATIONS
 
     HADOOP-3274. The default constructor of BytesWritable creates empty 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/InterTrackerProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/InterTrackerProtocol.java?rev=663829&r1=663828&r2=663829&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/InterTrackerProtocol.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/InterTrackerProtocol.java Thu Jun
 5 22:40:21 2008
@@ -42,8 +42,9 @@
    * version 10 changes the TaskStatus representation for HADOOP-2208
    * version 11 changes string to JobID in getTaskCompletionEvents().
    * version 12 changes the counters representation for HADOOP-1915
+   * version 13 added call getBuildVersion() for HADOOP-236
    */
-  public static final long versionID = 12L;
+  public static final long versionID = 13L;
   
   public final static int TRACKERS_OK = 0;
   public final static int UNKNOWN_TASKTRACKER = 1;
@@ -102,6 +103,11 @@
   TaskCompletionEvent[] getTaskCompletionEvents(JobID jobid, int fromEventId
       , int maxEvents) throws IOException;
   
+  
+  /**
+   * Returns the buildVersion of the JobTracker 
+   */
+  public String getBuildVersion() throws IOException;
 }
 
 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=663829&r1=663828&r2=663829&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Thu Jun  5 22:40:21
2008
@@ -65,6 +65,7 @@
 import org.apache.hadoop.util.HostsFileReader;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.VersionInfo;
 
 /*******************************************************
  * JobTracker is the central location for submitting and 
@@ -1224,6 +1225,10 @@
   ////////////////////////////////////////////////////
   // InterTrackerProtocol
   ////////////////////////////////////////////////////
+  
+  public String getBuildVersion() throws IOException{
+    return VersionInfo.getBuildVersion();
+  }
 
   /**
    * The periodic heartbeat mechanism between the {@link TaskTracker} and

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=663829&r1=663828&r2=663829&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Thu Jun  5 22:40:21
2008
@@ -75,6 +75,7 @@
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.RunJar;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.VersionInfo;
 import org.apache.hadoop.util.DiskChecker.DiskErrorException;
 import org.apache.hadoop.util.Shell.ShellCommandExecutor;
 import org.apache.log4j.LogManager;
@@ -899,6 +900,23 @@
           }
         }
 
+        //verify the buildVersion if justStarted
+        if(justStarted){
+          String jobTrackerBV = jobClient.getBuildVersion();
+          if(!VersionInfo.getBuildVersion().equals(jobTrackerBV)) {
+            String msg = "Shutting down. Incompatible buildVersion." +
+            "\nJobTracker's: " + jobTrackerBV + 
+            "\nTaskTracker's: "+ VersionInfo.getBuildVersion();
+            LOG.error(msg);
+            try {
+              jobClient.reportTaskTrackerError(taskTrackerName, null, msg);
+            } catch(Exception e ) {
+              LOG.info("Problem reporting to jobtracker: " + e);
+            }
+            return State.DENIED;
+          }
+        }
+        
         // Send the heartbeat and process the jobtracker's directives
         HeartbeatResponse heartbeatResponse = transmitHeartBeat();
         TaskTrackerAction[] actions = heartbeatResponse.getActions();

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/util/VersionInfo.java?rev=663829&r1=663828&r2=663829&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/util/VersionInfo.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/util/VersionInfo.java Thu Jun  5 22:40:21
2008
@@ -80,6 +80,17 @@
     return version != null ? version.url() : "Unknown";
   }
   
+  /**
+   * Returns the buildVersion which includes version, 
+   * revision, user and date. 
+   */
+  public static String getBuildVersion(){
+    return VersionInfo.getVersion() + 
+    " from " + VersionInfo.getRevision() +
+    " by " + VersionInfo.getUser() + 
+    " on " + VersionInfo.getDate();
+  }
+  
   public static void main(String[] args) {
     System.out.println("Hadoop " + getVersion());
     System.out.println("Subversion " + getUrl() + " -r " + getRevision());



Mime
View raw message