HBASE-4297 TableMapReduceUtil overwrites user supplied options

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1166767 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-09-08 15:52:25 +00:00
parent c6d4b05ad7
commit a39ce83a18
3 changed files with 22 additions and 12 deletions

View File

@ -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)

View File

@ -54,9 +54,7 @@ public class HBaseConfiguration extends Configuration {
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 Configuration {
*/
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());
}
}
}

View File

@ -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);
}
@ -334,7 +334,7 @@ public class TableMapReduceUtil {
String serverImpl, boolean addDependencyJars) throws IOException {
Configuration conf = job.getConfiguration();
HBaseConfiguration.addHbaseResources(conf);
HBaseConfiguration.merge(conf, HBaseConfiguration.create(conf));
job.setOutputFormatClass(TableOutputFormat.class);
if (reducer != null) job.setReducerClass(reducer);
conf.set(TableOutputFormat.OUTPUT_TABLE, table);