Browse Source

MAPREDUCE-832. Reduce number of warning messages printed when deprecated memory variables are used. Contributed by Rahul Kumar Singh.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20@806068 13f79535-47bb-0310-9956-ffa450edef68
Hemanth Yamijala 16 years ago
parent
commit
0f40484fe5
2 changed files with 20 additions and 13 deletions
  1. 3 0
      CHANGES.txt
  2. 17 13
      src/mapred/org/apache/hadoop/mapred/JobConf.java

+ 3 - 0
CHANGES.txt

@@ -214,6 +214,9 @@ Release 0.20.1 - Unreleased
     (Bill Zeller via szetszwo)
     (Bill Zeller via szetszwo)
 
 
     HDFS-527. Remove unnecessary DFSClient constructors.  (szetszwo)
     HDFS-527. Remove unnecessary DFSClient constructors.  (szetszwo)
+
+    MAPREDUCE-832. Reduce number of warning messages printed when 
+    deprecated memory variables are used. (Rahul Kumar Singh via yhemanth)
  
  
 Release 0.20.0 - 2009-04-15
 Release 0.20.0 - 2009-04-15
 
 

+ 17 - 13
src/mapred/org/apache/hadoop/mapred/JobConf.java

@@ -160,7 +160,9 @@ public class JobConf extends Configuration {
   /**
   /**
    * Construct a map/reduce job configuration.
    * Construct a map/reduce job configuration.
    */
    */
-  public JobConf() {}
+  public JobConf() {
+    checkAndWarnDeprecation();
+  }
 
 
   /** 
   /** 
    * Construct a map/reduce job configuration.
    * Construct a map/reduce job configuration.
@@ -169,6 +171,7 @@ public class JobConf extends Configuration {
    */
    */
   public JobConf(Class exampleClass) {
   public JobConf(Class exampleClass) {
     setJarByClass(exampleClass);
     setJarByClass(exampleClass);
+    checkAndWarnDeprecation();
   }
   }
   
   
   /**
   /**
@@ -178,6 +181,7 @@ public class JobConf extends Configuration {
    */
    */
   public JobConf(Configuration conf) {
   public JobConf(Configuration conf) {
     super(conf);
     super(conf);
+    checkAndWarnDeprecation();
   }
   }
 
 
 
 
@@ -207,6 +211,7 @@ public class JobConf extends Configuration {
   public JobConf(Path config) {
   public JobConf(Path config) {
     super();
     super();
     addResource(config);
     addResource(config);
+    checkAndWarnDeprecation();
   }
   }
 
 
   /** A new map/reduce configuration where the behavior of reading from the
   /** A new map/reduce configuration where the behavior of reading from the
@@ -219,6 +224,7 @@ public class JobConf extends Configuration {
    */
    */
   public JobConf(boolean loadDefaults) {
   public JobConf(boolean loadDefaults) {
     super(loadDefaults);
     super(loadDefaults);
+    checkAndWarnDeprecation();
   }
   }
 
 
   /**
   /**
@@ -1423,12 +1429,6 @@ public class JobConf extends Configuration {
 
 
   public long getMemoryForMapTask() {
   public long getMemoryForMapTask() {
     if (get(MAPRED_TASK_MAXVMEM_PROPERTY) != null) {
     if (get(MAPRED_TASK_MAXVMEM_PROPERTY) != null) {
-      LOG.warn(
-        JobConf.deprecatedString(
-          JobConf.MAPRED_TASK_MAXVMEM_PROPERTY)+
-          " instead use  "+JobConf.MAPRED_JOB_MAP_MEMORY_MB_PROPERTY + " and "
-          + JobConf.MAPRED_JOB_REDUCE_MEMORY_MB_PROPERTY);
-
       long val = getLong(
       long val = getLong(
         MAPRED_TASK_MAXVMEM_PROPERTY, DISABLED_MEMORY_LIMIT);
         MAPRED_TASK_MAXVMEM_PROPERTY, DISABLED_MEMORY_LIMIT);
       return (val == DISABLED_MEMORY_LIMIT) ? val :
       return (val == DISABLED_MEMORY_LIMIT) ? val :
@@ -1445,11 +1445,6 @@ public class JobConf extends Configuration {
 
 
   public long getMemoryForReduceTask() {
   public long getMemoryForReduceTask() {
     if (get(MAPRED_TASK_MAXVMEM_PROPERTY) != null) {
     if (get(MAPRED_TASK_MAXVMEM_PROPERTY) != null) {
-      LOG.warn(
-        JobConf.deprecatedString(
-          JobConf.MAPRED_TASK_MAXVMEM_PROPERTY)+
-        " instead use  "+JobConf.MAPRED_JOB_MAP_MEMORY_MB_PROPERTY + " and "
-        + JobConf.MAPRED_JOB_REDUCE_MEMORY_MB_PROPERTY);
       long val = getLong(
       long val = getLong(
         MAPRED_TASK_MAXVMEM_PROPERTY, DISABLED_MEMORY_LIMIT);
         MAPRED_TASK_MAXVMEM_PROPERTY, DISABLED_MEMORY_LIMIT);
       return (val == DISABLED_MEMORY_LIMIT) ? val :
       return (val == DISABLED_MEMORY_LIMIT) ? val :
@@ -1628,8 +1623,17 @@ public class JobConf extends Configuration {
   }
   }
 
 
   static String deprecatedString(String key) {
   static String deprecatedString(String key) {
-    return "The variable " + key + " is no longer used";
+    return "The variable " + key + " is no longer used.";
+  }
+
+  private void checkAndWarnDeprecation() {
+    if(get(JobConf.MAPRED_TASK_MAXVMEM_PROPERTY) != null) {
+      LOG.warn(JobConf.deprecatedString(JobConf.MAPRED_TASK_MAXVMEM_PROPERTY)
+                + " Instead use " + JobConf.MAPRED_JOB_MAP_MEMORY_MB_PROPERTY
+                + " and " + JobConf.MAPRED_JOB_REDUCE_MEMORY_MB_PROPERTY);
+    }
   }
   }
+  
 
 
 }
 }