Repository: incubator-sentry Updated Branches: refs/heads/master 07df5fbad -> 5720b64d2
SENTRY-1088: PathsUpdate should log invalid paths to make troubleshooting easier (Ryan Pridgeon via Hao Hao) Change-Id: I33f86e47624e1d20c227ad70acb01c8009e73386 Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/5720b64d Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/5720b64d Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/5720b64d Branch: refs/heads/master Commit: 5720b64d277417e511bfe230f260503016f7b7cb Parents: 07df5fb Author: hahao <[email protected]> Authored: Mon Mar 21 23:54:43 2016 -0700 Committer: hahao <[email protected]> Committed: Mon Mar 21 23:54:43 2016 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/sentry/hdfs/PathsUpdate.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/5720b64d/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java ---------------------------------------------------------------------- diff --git a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java index 50ef112..a091f71 100644 --- a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java +++ b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java @@ -34,7 +34,8 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.conf.Configuration; import com.google.common.collect.Lists; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -43,6 +44,8 @@ import com.google.common.collect.Lists; */ public class PathsUpdate implements Updateable.Update { + private static final Logger LOGGER = LoggerFactory.getLogger(PathsUpdate.class); + public static String ALL_PATHS = "__ALL_PATHS__"; private static final Configuration CONF = new Configuration(); private final TPathsUpdate tPathsUpdate; @@ -104,7 +107,7 @@ public class PathsUpdate implements Updateable.Update { */ public static List<String> parsePath(String path) { try { - + LOGGER.debug("Parsing path " + path); URI uri = null; if (StringUtils.isNotEmpty(path)) { uri = new URI(URIUtil.encodePath(path)); @@ -124,9 +127,11 @@ public class PathsUpdate implements Updateable.Update { // Non-HDFS paths will be skipped. if(scheme.equalsIgnoreCase("hdfs")) { + return Lists.newArrayList(uri.getPath().split("^/")[1] .split("/")); } else { + LOGGER.warn("Invalid FS: " + scheme + "://; expected hdfs://"); return null; } } catch (URISyntaxException e) {
