HADOOP-15474. Rename properties introduced for <tags>. Contributed by Zsolt Venczel.

This commit is contained in:
Mukul Kumar Singh 2018-05-22 13:33:31 +05:30
parent 5e88126776
commit 57c2feb0d3
4 changed files with 42 additions and 6 deletions

View File

@ -198,8 +198,8 @@
* <h4 id="Tags">Tags</h4>
*
* <p>Optionally we can tag related properties together by using tag
* attributes. System tags are defined by hadoop.system.tags property. Users
* can define there own custom tags in hadoop.custom.tags property.
* attributes. System tags are defined by hadoop.tags.system property. Users
* can define there own custom tags in hadoop.tags.custom property.
*
* <p>For example, we can tag existing property as:
* <tt><pre>
@ -3180,12 +3180,24 @@ private Resource loadResource(Properties properties,
}
/**
* Add tags defined in HADOOP_SYSTEM_TAGS, HADOOP_CUSTOM_TAGS.
* Add tags defined in HADOOP_TAGS_SYSTEM, HADOOP_TAGS_CUSTOM.
* @param prop
*/
public void addTags(Properties prop) {
// Get all system tags
try {
if (prop.containsKey(CommonConfigurationKeys.HADOOP_TAGS_SYSTEM)) {
String systemTags = prop.getProperty(CommonConfigurationKeys
.HADOOP_TAGS_SYSTEM);
Arrays.stream(systemTags.split(",")).forEach(tag -> TAGS.add(tag));
}
// Get all custom tags
if (prop.containsKey(CommonConfigurationKeys.HADOOP_TAGS_CUSTOM)) {
String customTags = prop.getProperty(CommonConfigurationKeys
.HADOOP_TAGS_CUSTOM);
Arrays.stream(customTags.split(",")).forEach(tag -> TAGS.add(tag));
}
if (prop.containsKey(CommonConfigurationKeys.HADOOP_SYSTEM_TAGS)) {
String systemTags = prop.getProperty(CommonConfigurationKeys
.HADOOP_SYSTEM_TAGS);

View File

@ -881,7 +881,22 @@ public class CommonConfigurationKeysPublic {
"credential$",
"oauth.*token$",
HADOOP_SECURITY_SENSITIVE_CONFIG_KEYS);
/**
* @deprecated Please use
* {@link CommonConfigurationKeysPublic#HADOOP_TAGS_SYSTEM} instead
* See https://issues.apache.org/jira/browse/HADOOP-15474
*/
public static final String HADOOP_SYSTEM_TAGS = "hadoop.system.tags";
/**
* @deprecated Please use
* {@link CommonConfigurationKeysPublic#HADOOP_TAGS_CUSTOM} instead
* See https://issues.apache.org/jira/browse/HADOOP-15474
*/
public static final String HADOOP_CUSTOM_TAGS = "hadoop.custom.tags";
public static final String HADOOP_TAGS_SYSTEM = "hadoop.tags.system";
public static final String HADOOP_TAGS_CUSTOM = "hadoop.tags.custom";
}

View File

@ -3035,7 +3035,16 @@
<property>
<name>hadoop.system.tags</name>
<value>YARN,HDFS,NAMENODE,DATANODE,REQUIRED,SECURITY,KERBEROS,PERFORMANCE,CLIENT
,SERVER,DEBUG,DEPRICATED,COMMON,OPTIONAL</value>
,SERVER,DEBUG,DEPRECATED,COMMON,OPTIONAL</value>
<description>
Deprecated. Please use hadoop.tags.system instead.
</description>
</property>
<property>
<name>hadoop.tags.system</name>
<value>YARN,HDFS,NAMENODE,DATANODE,REQUIRED,SECURITY,KERBEROS,PERFORMANCE,CLIENT
,SERVER,DEBUG,DEPRECATED,COMMON,OPTIONAL</value>
<description>
System tags to group related properties together.
</description>

View File

@ -2361,8 +2361,8 @@ public void testGetAllPropertiesByTags() throws Exception {
try{
out = new BufferedWriter(new FileWriter(CONFIG_CORE));
startConfig();
appendProperty("hadoop.system.tags", "YARN,HDFS,NAMENODE");
appendProperty("hadoop.custom.tags", "MYCUSTOMTAG");
appendProperty("hadoop.tags.system", "YARN,HDFS,NAMENODE");
appendProperty("hadoop.tags.custom", "MYCUSTOMTAG");
appendPropertyByTag("dfs.cblock.trace.io", "false", "YARN");
appendPropertyByTag("dfs.replication", "1", "HDFS");
appendPropertyByTag("dfs.namenode.logging.level", "INFO", "NAMENODE");