HBASE-1833 hfle.main fixes
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@815507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1ad7e64d3
commit
651490942d
|
@ -52,6 +52,7 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-1827 Add disabling block cache scanner flag to the shell
|
HBASE-1827 Add disabling block cache scanner flag to the shell
|
||||||
HBASE-1835 Add more delete tests
|
HBASE-1835 Add more delete tests
|
||||||
HBASE-1574 Client and server APIs to do batch deletes
|
HBASE-1574 Client and server APIs to do batch deletes
|
||||||
|
HBASE-1833 hfile.main fixes
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
|
|
|
@ -1639,13 +1639,16 @@ public class HFile {
|
||||||
try {
|
try {
|
||||||
// create options
|
// create options
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
options.addOption("v", "verbose", false, "verbose output");
|
options.addOption("v", "verbose", false, "Verbose output; emits file and meta data delimiters");
|
||||||
options.addOption("p", "printkv", false, "print key/value pairs");
|
options.addOption("p", "printkv", false, "Print key/value pairs");
|
||||||
options.addOption("m", "printmeta", false, "print meta data of file");
|
options.addOption("m", "printmeta", false, "Print meta data of file");
|
||||||
options.addOption("k", "checkrow", false, "enable row order check");
|
options.addOption("k", "checkrow", false,
|
||||||
options.addOption("a", "checkfamily", false, "enable family check");
|
"Enable row order check; looks for out-of-order keys");
|
||||||
options.addOption("f", "file", true, "file to scan");
|
options.addOption("a", "checkfamily", false, "Enable family check");
|
||||||
options.addOption("r", "region", true, "region to scan");
|
options.addOption("f", "file", true,
|
||||||
|
"File to scan. Pass full-path; e.g. hdfs://a:9000/hbase/.META./12/34");
|
||||||
|
options.addOption("r", "region", true,
|
||||||
|
"Region to scan. Pass region name; e.g. '.META.,,1'");
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
HelpFormatter formatter = new HelpFormatter();
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
formatter.printHelp("HFile ", options, true);
|
formatter.printHelp("HFile ", options, true);
|
||||||
|
@ -1660,6 +1663,8 @@ public class HFile {
|
||||||
boolean checkFamily = cmd.hasOption("a");
|
boolean checkFamily = cmd.hasOption("a");
|
||||||
// get configuration, file system and get list of files
|
// get configuration, file system and get list of files
|
||||||
HBaseConfiguration conf = new HBaseConfiguration();
|
HBaseConfiguration conf = new HBaseConfiguration();
|
||||||
|
conf.set("fs.default.name",
|
||||||
|
conf.get(org.apache.hadoop.hbase.HConstants.HBASE_DIR));
|
||||||
FileSystem fs = FileSystem.get(conf);
|
FileSystem fs = FileSystem.get(conf);
|
||||||
ArrayList<Path> files = new ArrayList<Path>();
|
ArrayList<Path> files = new ArrayList<Path>();
|
||||||
if (cmd.hasOption("f")) {
|
if (cmd.hasOption("f")) {
|
||||||
|
@ -1675,18 +1680,17 @@ public class HFile {
|
||||||
Path regionDir = new Path(tableDir, Integer.toString(enc));
|
Path regionDir = new Path(tableDir, Integer.toString(enc));
|
||||||
if (verbose) System.out.println("region dir -> " + regionDir);
|
if (verbose) System.out.println("region dir -> " + regionDir);
|
||||||
List<Path> regionFiles = getStoreFiles(fs, regionDir);
|
List<Path> regionFiles = getStoreFiles(fs, regionDir);
|
||||||
System.out.println("Number of region files found -> " +
|
if (verbose) System.out.println("Number of region files found -> " +
|
||||||
regionFiles.size());
|
regionFiles.size());
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (Path p : regionFiles) {
|
for (Path p : regionFiles) {
|
||||||
System.out.println("Found file[" + i++ + "] -> " + p);
|
if (verbose) System.out.println("Found file[" + i++ + "] -> " + p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
files.addAll(regionFiles);
|
files.addAll(regionFiles);
|
||||||
}
|
}
|
||||||
// iterate over all files found
|
// iterate over all files found
|
||||||
System.out.println("\nStart scan of files...\n");
|
|
||||||
for (Path file : files) {
|
for (Path file : files) {
|
||||||
if (verbose) System.out.println("Scanning -> " + file);
|
if (verbose) System.out.println("Scanning -> " + file);
|
||||||
if (!fs.exists(file)) {
|
if (!fs.exists(file)) {
|
||||||
|
@ -1756,7 +1760,6 @@ public class HFile {
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
System.out.println("\nDone.");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue