From e6b7112c8837d918614fe3571d1fe077cc061aa1 Mon Sep 17 00:00:00 2001 From: Chris Douglas Date: Tue, 5 Sep 2017 23:30:18 -0700 Subject: [PATCH] HADOOP-12077. Provide a multi-URI replication Inode for ViewFs. Contributed by Gera Shegalov (cherry picked from commit 6d3d01d7ad5bff0e057761c288a2e0c9263b9ed3) --- .../apache/hadoop/fs/viewfs/ConfigUtil.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ConfigUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ConfigUtil.java index bb941c76346..498398a8621 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ConfigUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ConfigUtil.java @@ -68,6 +68,32 @@ public class ConfigUtil { src, target); } + /** + * + * @param conf + * @param mountTableName + * @param src + * @param settings + * @param targets + */ + public static void addLinkNfly(Configuration conf, String mountTableName, + String src, String settings, final URI ... targets) { + + settings = settings == null + ? "minReplication=2,repairOnRead=true" + : settings; + + conf.set(getConfigViewFsPrefix(mountTableName) + "." + + Constants.CONFIG_VIEWFS_LINK_NFLY + "." + settings + "." + src, + StringUtils.uriToString(targets)); + } + + public static void addLinkNfly(final Configuration conf, final String src, + final URI ... targets) { + addLinkNfly(conf, Constants.CONFIG_VIEWFS_DEFAULT_MOUNT_TABLE, src, null, + targets); + } + /** * Add config variable for homedir for default mount table * @param conf - add to this conf