HBASE-3476 HFile -m option need not scan key values (Prakash Khemani via Lars George)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1064034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d1d0924f61
commit
df5fcf6445
|
@ -28,6 +28,8 @@ Release 0.91.0 - Unreleased
|
||||||
HBASE-3387 Pair does not deep check arrays for equality -- REVERT THIS PATCH
|
HBASE-3387 Pair does not deep check arrays for equality -- REVERT THIS PATCH
|
||||||
HBASE-3449 Server shutdown handlers deadlocked waiting for META
|
HBASE-3449 Server shutdown handlers deadlocked waiting for META
|
||||||
HBASE-3456 Fix hardcoding of 20 second socket timeout down in HBaseClient
|
HBASE-3456 Fix hardcoding of 20 second socket timeout down in HBaseClient
|
||||||
|
HBASE-3476 HFile -m option need not scan key values
|
||||||
|
(Prakash Khemani via Lars George)
|
||||||
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
|
@ -1951,45 +1951,47 @@ public class HFile {
|
||||||
// create reader and load file info
|
// create reader and load file info
|
||||||
HFile.Reader reader = new HFile.Reader(fs, file, null, false, false);
|
HFile.Reader reader = new HFile.Reader(fs, file, null, false, false);
|
||||||
Map<byte[],byte[]> fileInfo = reader.loadFileInfo();
|
Map<byte[],byte[]> fileInfo = reader.loadFileInfo();
|
||||||
// scan over file and read key/value's and check if requested
|
|
||||||
HFileScanner scanner = reader.getScanner(false, false);
|
|
||||||
scanner.seekTo();
|
|
||||||
KeyValue pkv = null;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
do {
|
if (verbose || printKeyValue || checkRow || checkFamily) {
|
||||||
KeyValue kv = scanner.getKeyValue();
|
// scan over file and read key/value's and check if requested
|
||||||
// dump key value
|
HFileScanner scanner = reader.getScanner(false, false);
|
||||||
if (printKeyValue) {
|
scanner.seekTo();
|
||||||
System.out.println("K: " + kv +
|
KeyValue pkv = null;
|
||||||
" V: " + Bytes.toStringBinary(kv.getValue()));
|
do {
|
||||||
}
|
KeyValue kv = scanner.getKeyValue();
|
||||||
// check if rows are in order
|
// dump key value
|
||||||
if (checkRow && pkv != null) {
|
if (printKeyValue) {
|
||||||
if (Bytes.compareTo(pkv.getRow(), kv.getRow()) > 0) {
|
System.out.println("K: " + kv +
|
||||||
System.err.println("WARNING, previous row is greater then" +
|
" V: " + Bytes.toStringBinary(kv.getValue()));
|
||||||
" current row\n\tfilename -> " + file +
|
|
||||||
"\n\tprevious -> " + Bytes.toStringBinary(pkv.getKey()) +
|
|
||||||
"\n\tcurrent -> " + Bytes.toStringBinary(kv.getKey()));
|
|
||||||
}
|
}
|
||||||
}
|
// check if rows are in order
|
||||||
// check if families are consistent
|
if (checkRow && pkv != null) {
|
||||||
if (checkFamily) {
|
if (Bytes.compareTo(pkv.getRow(), kv.getRow()) > 0) {
|
||||||
String fam = Bytes.toString(kv.getFamily());
|
System.err.println("WARNING, previous row is greater then" +
|
||||||
if (!file.toString().contains(fam)) {
|
" current row\n\tfilename -> " + file +
|
||||||
System.err.println("WARNING, filename does not match kv family," +
|
"\n\tprevious -> " + Bytes.toStringBinary(pkv.getKey()) +
|
||||||
"\n\tfilename -> " + file +
|
"\n\tcurrent -> " + Bytes.toStringBinary(kv.getKey()));
|
||||||
"\n\tkeyvalue -> " + Bytes.toStringBinary(kv.getKey()));
|
}
|
||||||
}
|
}
|
||||||
if (pkv != null && Bytes.compareTo(pkv.getFamily(), kv.getFamily()) != 0) {
|
// check if families are consistent
|
||||||
System.err.println("WARNING, previous kv has different family" +
|
if (checkFamily) {
|
||||||
" compared to current key\n\tfilename -> " + file +
|
String fam = Bytes.toString(kv.getFamily());
|
||||||
"\n\tprevious -> " + Bytes.toStringBinary(pkv.getKey()) +
|
if (!file.toString().contains(fam)) {
|
||||||
"\n\tcurrent -> " + Bytes.toStringBinary(kv.getKey()));
|
System.err.println("WARNING, filename does not match kv family," +
|
||||||
|
"\n\tfilename -> " + file +
|
||||||
|
"\n\tkeyvalue -> " + Bytes.toStringBinary(kv.getKey()));
|
||||||
|
}
|
||||||
|
if (pkv != null && Bytes.compareTo(pkv.getFamily(), kv.getFamily()) != 0) {
|
||||||
|
System.err.println("WARNING, previous kv has different family" +
|
||||||
|
" compared to current key\n\tfilename -> " + file +
|
||||||
|
"\n\tprevious -> " + Bytes.toStringBinary(pkv.getKey()) +
|
||||||
|
"\n\tcurrent -> " + Bytes.toStringBinary(kv.getKey()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
pkv = kv;
|
||||||
pkv = kv;
|
count++;
|
||||||
count++;
|
} while (scanner.next());
|
||||||
} while (scanner.next());
|
}
|
||||||
if (verbose || printKeyValue) {
|
if (verbose || printKeyValue) {
|
||||||
System.out.println("Scanned kv count -> " + count);
|
System.out.println("Scanned kv count -> " + count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue