Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.stream.Collectors;

import org.apache.hadoop.conf.Configuration;
Expand All @@ -46,7 +48,8 @@
import com.google.common.base.Preconditions;
import org.apache.ratis.server.RaftServerConfigKeys;

import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_TAGS_CUSTOM;
import static java.util.Collections.unmodifiableSortedSet;
import static java.util.stream.Collectors.toCollection;
import static org.apache.hadoop.hdds.ratis.RatisHelper.HDDS_DATANODE_RATIS_PREFIX_KEY;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_CONTAINER_COPY_WORKDIR;

Expand All @@ -56,8 +59,11 @@
@InterfaceAudience.Private
public class OzoneConfiguration extends Configuration
implements MutableConfigurationSource {
public static final String OZONE_TAGS_SYSTEM_KEY =
"ozone.tags.system";

public static final SortedSet<String> TAGS = unmodifiableSortedSet(
Arrays.stream(ConfigTag.values())
.map(Enum::name)
.collect(toCollection(TreeSet::new)));

static {
addDeprecatedKeys();
Expand Down Expand Up @@ -309,17 +315,8 @@ public Map<String, String> getPropsMatchPrefixAndTrimPrefix(
}

@Override
public void addTags(Properties prop) {
if (!prop.containsKey(OZONE_TAGS_SYSTEM_KEY)) {
String ozoneTags = Arrays.stream(ConfigTag.values())
.map(Enum::name)
.sorted()
.collect(Collectors.joining(","));
prop.setProperty(HADOOP_TAGS_CUSTOM, ozoneTags);
prop.setProperty(OZONE_TAGS_SYSTEM_KEY, ozoneTags);
}

super.addTags(prop);
public boolean isPropertyTag(String tagStr) {
return TAGS.contains(tagStr) || super.isPropertyTag(tagStr);
}

private static void addDeprecatedKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import com.google.common.annotations.VisibleForTesting;
import com.google.gson.Gson;
import static org.apache.hadoop.hdds.conf.OzoneConfiguration.OZONE_TAGS_SYSTEM_KEY;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -157,8 +156,7 @@ private void processConfigTagRequest(HttpServletRequest request,

switch (cmd) {
case "getOzoneTags":
out.write(gson.toJson(config.get(OZONE_TAGS_SYSTEM_KEY)
.split(",")));
out.write(gson.toJson(OzoneConfiguration.TAGS));
break;
case "getPropertyByTag":
String tags = request.getParameter("tags");
Expand Down