SENTRY-1088: PathsUpdate should log invalid paths to make troubleshooting easier (Ryan Pridgeon via Hao Hao)
Change-Id: I33f86e47624e1d20c227ad70acb01c8009e73386
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.conf.Configuration;
import com.google.common.collect.Lists;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -43,6 +44,8 @@
*/
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 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 @@
// 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) {