|
@@ -229,7 +229,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
private static final Logger LOG_DEPRECATION =
|
|
|
LoggerFactory.getLogger(
|
|
|
"org.apache.hadoop.conf.Configuration.deprecation");
|
|
|
- private static final Set<String> TAGS = new HashSet<>();
|
|
|
+ private static final Set<String> TAGS = ConcurrentHashMap.newKeySet();
|
|
|
|
|
|
private boolean quietmode = true;
|
|
|
|
|
@@ -2935,7 +2935,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
resources.set(i, ret);
|
|
|
}
|
|
|
}
|
|
|
- this.removeUndeclaredTags(properties);
|
|
|
+ this.addTags(properties);
|
|
|
}
|
|
|
|
|
|
private Resource loadResource(Properties properties,
|
|
@@ -3183,29 +3183,28 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Removes undeclared tags and related properties from propertyTagsMap.
|
|
|
- * Its required because ordering of properties in xml config files is not
|
|
|
- * guaranteed.
|
|
|
+ * Add tags defined in HADOOP_SYSTEM_TAGS, HADOOP_CUSTOM_TAGS.
|
|
|
* @param prop
|
|
|
*/
|
|
|
- private void removeUndeclaredTags(Properties prop) {
|
|
|
+ public void addTags(Properties prop) {
|
|
|
// Get all system tags
|
|
|
- if (prop.containsKey(CommonConfigurationKeys.HADOOP_SYSTEM_TAGS)){
|
|
|
- String systemTags = prop.getProperty(CommonConfigurationKeys
|
|
|
- .HADOOP_SYSTEM_TAGS);
|
|
|
- Arrays.stream(systemTags.split(",")).forEach(tag -> TAGS.add(tag));
|
|
|
- }
|
|
|
- // Get all custom tags
|
|
|
- if (prop.containsKey(CommonConfigurationKeys.HADOOP_CUSTOM_TAGS)) {
|
|
|
- String customTags = prop.getProperty(CommonConfigurationKeys
|
|
|
- .HADOOP_CUSTOM_TAGS);
|
|
|
- Arrays.stream(customTags.split(",")).forEach(tag -> TAGS.add(tag));
|
|
|
- }
|
|
|
+ try {
|
|
|
+ if (prop.containsKey(CommonConfigurationKeys.HADOOP_SYSTEM_TAGS)) {
|
|
|
+ String systemTags = prop.getProperty(CommonConfigurationKeys
|
|
|
+ .HADOOP_SYSTEM_TAGS);
|
|
|
+ Arrays.stream(systemTags.split(",")).forEach(tag -> TAGS.add(tag));
|
|
|
+ }
|
|
|
+ // Get all custom tags
|
|
|
+ if (prop.containsKey(CommonConfigurationKeys.HADOOP_CUSTOM_TAGS)) {
|
|
|
+ String customTags = prop.getProperty(CommonConfigurationKeys
|
|
|
+ .HADOOP_CUSTOM_TAGS);
|
|
|
+ Arrays.stream(customTags.split(",")).forEach(tag -> TAGS.add(tag));
|
|
|
+ }
|
|
|
|
|
|
- Set undeclaredTags = propertyTagsMap.keySet();
|
|
|
- if (undeclaredTags.retainAll(TAGS)) {
|
|
|
- LOG.info("Removed undeclared tags:");
|
|
|
+ } catch (Exception ex) {
|
|
|
+ LOG.trace("Error adding tags in configuration", ex);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3219,8 +3218,8 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
private void readTagFromConfig(String attributeValue, String confName, String
|
|
|
confValue, List<String> confSource) {
|
|
|
for (String tagStr : attributeValue.split(",")) {
|
|
|
- tagStr = tagStr.trim();
|
|
|
try {
|
|
|
+ tagStr = tagStr.trim();
|
|
|
// Handle property with no/null value
|
|
|
if (confValue == null) {
|
|
|
confValue = "";
|