HADOOP-11912. Extra configuration key used in TraceUtils should respect prefix (Masatake Iwasaki via Colin P. McCabe)
This commit is contained in:
parent
4402e4c633
commit
90b3845648
|
@ -612,6 +612,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
|
|
||||||
HADOOP-11926. test-patch.sh mv does wrong math (aw)
|
HADOOP-11926. test-patch.sh mv does wrong math (aw)
|
||||||
|
|
||||||
|
HADOOP-11912. Extra configuration key used in TraceUtils should respect
|
||||||
|
prefix (Masatake Iwasaki via Colin P. McCabe)
|
||||||
|
|
||||||
Release 2.7.1 - UNRELEASED
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -47,18 +47,16 @@ public class TraceUtils {
|
||||||
return new HTraceConfiguration() {
|
return new HTraceConfiguration() {
|
||||||
@Override
|
@Override
|
||||||
public String get(String key) {
|
public String get(String key) {
|
||||||
if (extraMap.containsKey(key)) {
|
return get(key, "");
|
||||||
return extraMap.get(key);
|
|
||||||
}
|
|
||||||
return conf.get(prefix + key, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String get(String key, String defaultValue) {
|
public String get(String key, String defaultValue) {
|
||||||
if (extraMap.containsKey(key)) {
|
String prefixedKey = prefix + key;
|
||||||
return extraMap.get(key);
|
if (extraMap.containsKey(prefixedKey)) {
|
||||||
|
return extraMap.get(prefixedKey);
|
||||||
}
|
}
|
||||||
return conf.get(prefix + key, defaultValue);
|
return conf.get(prefixedKey, defaultValue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class TestTraceUtils {
|
||||||
conf.set(TEST_PREFIX + key, oldValue);
|
conf.set(TEST_PREFIX + key, oldValue);
|
||||||
LinkedList<ConfigurationPair> extraConfig =
|
LinkedList<ConfigurationPair> extraConfig =
|
||||||
new LinkedList<ConfigurationPair>();
|
new LinkedList<ConfigurationPair>();
|
||||||
extraConfig.add(new ConfigurationPair(key, newValue));
|
extraConfig.add(new ConfigurationPair(TEST_PREFIX + key, newValue));
|
||||||
HTraceConfiguration wrapped = TraceUtils.wrapHadoopConf(TEST_PREFIX, conf, extraConfig);
|
HTraceConfiguration wrapped = TraceUtils.wrapHadoopConf(TEST_PREFIX, conf, extraConfig);
|
||||||
assertEquals(newValue, wrapped.get(key));
|
assertEquals(newValue, wrapped.get(key));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue