hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1166767 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java
Date Thu, 08 Sep 2011 15:52:26 GMT
Author: stack
Date: Thu Sep  8 15:52:25 2011
New Revision: 1166767

URL: http://svn.apache.org/viewvc?rev=1166767&view=rev
Log:
HBASE-4297 TableMapReduceUtil overwrites user supplied options

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1166767&r1=1166766&r2=1166767&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Sep  8 15:52:25 2011
@@ -247,6 +247,8 @@ Release 0.91.0 - Unreleased
                (Ming Ma via garyh)
    HBASE-4341  HRS#closeAllRegions should take care of HRS#onlineRegions's
                weak consistency (Jieshan Bean)
+   HBASE-4297  TableMapReduceUtil overwrites user supplied options
+               (Jan Lukavsky)
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java?rev=1166767&r1=1166766&r2=1166767&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java Thu Sep  8 15:52:25
2011
@@ -54,9 +54,7 @@ public class HBaseConfiguration extends 
   public HBaseConfiguration(final Configuration c) {
     //TODO:replace with private constructor
     this();
-    for (Entry<String, String>e: c) {
-      set(e.getKey(), e.getValue());
-    }
+    merge(this, c);
   }
 
   private static void checkDefaultsVersion(Configuration conf) {
@@ -109,9 +107,19 @@ public class HBaseConfiguration extends 
    */
   public static Configuration create(final Configuration that) {
     Configuration conf = create();
-    for (Entry<String, String>e: that) {
-      conf.set(e.getKey(), e.getValue());
-    }
+    merge(conf, that);
     return conf;
   }
+
+  /**
+   * Merge two configurations.
+   * @param destConf the configuration that will be overwritten with items
+   *                 from the srcConf
+   * @param srcConf the source configuration
+   **/
+  public static void merge(Configuration destConf, Configuration srcConf) {
+    for (Entry<String, String> e : srcConf) {
+      destConf.set(e.getKey(), e.getValue());
+    }
+  }
 }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java?rev=1166767&r1=1166766&r2=1166767&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java Thu
Sep  8 15:52:25 2011
@@ -126,10 +126,10 @@ public class TableMapReduceUtil {
     if (outputValueClass != null) job.setMapOutputValueClass(outputValueClass);
     if (outputKeyClass != null) job.setMapOutputKeyClass(outputKeyClass);
     job.setMapperClass(mapper);
-    HBaseConfiguration.addHbaseResources(job.getConfiguration());
-    job.getConfiguration().set(TableInputFormat.INPUT_TABLE, table);
-    job.getConfiguration().set(TableInputFormat.SCAN,
-      convertScanToString(scan));
+    Configuration conf = job.getConfiguration();
+    HBaseConfiguration.merge(conf, HBaseConfiguration.create(conf));
+    conf.set(TableInputFormat.INPUT_TABLE, table);
+    conf.set(TableInputFormat.SCAN, convertScanToString(scan));
     if (addDependencyJars) {
       addDependencyJars(job);
     }
@@ -333,8 +333,8 @@ public class TableMapReduceUtil {
     Class partitioner, String quorumAddress, String serverClass,
     String serverImpl, boolean addDependencyJars) throws IOException {
 
-    Configuration conf = job.getConfiguration();
-    HBaseConfiguration.addHbaseResources(conf);
+    Configuration conf = job.getConfiguration();    
+    HBaseConfiguration.merge(conf, HBaseConfiguration.create(conf));
     job.setOutputFormatClass(TableOutputFormat.class);
     if (reducer != null) job.setReducerClass(reducer);
     conf.set(TableOutputFormat.OUTPUT_TABLE, table);



Mime
View raw message