ACCUMULO-2061 Add a warning about using paths with PrintInfo
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4ddaab80 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4ddaab80 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4ddaab80 Branch: refs/heads/ACCUMULO-2061 Commit: 4ddaab80828c2b0596cd6d63566b83844945d83a Parents: 7086a7e Author: Josh Elser <els...@apache.org> Authored: Wed Mar 12 12:11:48 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Wed Mar 12 12:11:48 2014 -0400 ---------------------------------------------------------------------- .../java/org/apache/accumulo/core/file/rfile/PrintInfo.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/4ddaab80/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java index 4e39fc7..7c0f067 100644 --- a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java +++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java @@ -31,10 +31,12 @@ import org.apache.accumulo.core.volume.VolumeConfiguration; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.log4j.Logger; import com.beust.jcommander.Parameter; public class PrintInfo { + private static final Logger log = Logger.getLogger(PrintInfo.class); static class Opts extends Help { @Parameter(names = {"-d", "--dump"}, description = "dump the key/value pairs") @@ -50,6 +52,8 @@ public class PrintInfo { @SuppressWarnings("deprecation") AccumuloConfiguration aconf = AccumuloConfiguration.getSiteConfiguration(); + // TODO This will only work for RFiles in HDFS when the filesystem is defined in the core-site.xml + // on the classpath if a path, and not a URI, is given FileSystem hadoopFs = VolumeConfiguration.getDefaultVolume(conf, aconf).getFileSystem(); FileSystem localFs = FileSystem.getLocal(conf); Opts opts = new Opts(); @@ -68,8 +72,11 @@ public class PrintInfo { FileSystem fs; if (arg.contains(":")) fs = path.getFileSystem(conf); - else + else { + // Recommend a URI is given for the above todo reason + log.warn("Attempting to find file across filesystems. Consider providing URI instead of path"); fs = hadoopFs.exists(path) ? hadoopFs : localFs; // fall back to local + } CachableBlockFile.Reader _rdr = new CachableBlockFile.Reader(fs, path, conf, null, null, aconf); Reader iter = new RFile.Reader(_rdr);