Repository: hbase Updated Branches: refs/heads/master 08274045c -> bb28a3b46
HBASE-18899 Make Fileinfo more readable in HFilePrettyPrinter Signed-off-by: Chia-Ping Tsai <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bb28a3b4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bb28a3b4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bb28a3b4 Branch: refs/heads/master Commit: bb28a3b4660a64bb513ffe4399e72679fc2dcec5 Parents: 0827404 Author: Guangxu Cheng <[email protected]> Authored: Fri Sep 29 01:10:59 2017 +0800 Committer: Chia-Ping Tsai <[email protected]> Committed: Sun Oct 8 03:27:29 2017 +0800 ---------------------------------------------------------------------- .../hbase/io/hfile/HFilePrettyPrinter.java | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/bb28a3b4/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java index 4524350..eed73df 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePrettyPrinter.java @@ -59,10 +59,12 @@ import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; +import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagUtil; +import org.apache.hadoop.hbase.regionserver.HStoreFile; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper; @@ -529,15 +531,27 @@ public class HFilePrettyPrinter extends Configured implements Tool { out.println("Fileinfo:"); for (Map.Entry<byte[], byte[]> e : fileInfo.entrySet()) { out.print(FOUR_SPACES + Bytes.toString(e.getKey()) + " = "); - if (Bytes.compareTo(e.getKey(), Bytes.toBytes("MAX_SEQ_ID_KEY")) == 0) { - long seqid = Bytes.toLong(e.getValue()); - out.println(seqid); - } else if (Bytes.compareTo(e.getKey(), Bytes.toBytes("TIMERANGE")) == 0) { + if (Bytes.equals(e.getKey(), HStoreFile.MAX_SEQ_ID_KEY) + || Bytes.equals(e.getKey(), HStoreFile.DELETE_FAMILY_COUNT) + || Bytes.equals(e.getKey(), HStoreFile.EARLIEST_PUT_TS) + || Bytes.equals(e.getKey(), HFileWriterImpl.MAX_MEMSTORE_TS_KEY) + || Bytes.equals(e.getKey(), FileInfo.CREATE_TIME_TS) + || Bytes.equals(e.getKey(), HStoreFile.BULKLOAD_TIME_KEY)) { + out.println(Bytes.toLong(e.getValue())); + } else if (Bytes.equals(e.getKey(), HStoreFile.TIMERANGE_KEY)) { TimeRangeTracker timeRangeTracker = TimeRangeTracker.getTimeRangeTracker(e.getValue()); out.println(timeRangeTracker.getMin() + "...." + timeRangeTracker.getMax()); - } else if (Bytes.compareTo(e.getKey(), FileInfo.AVG_KEY_LEN) == 0 - || Bytes.compareTo(e.getKey(), FileInfo.AVG_VALUE_LEN) == 0) { + } else if (Bytes.equals(e.getKey(), FileInfo.AVG_KEY_LEN) + || Bytes.equals(e.getKey(), FileInfo.AVG_VALUE_LEN) + || Bytes.equals(e.getKey(), HFileWriterImpl.KEY_VALUE_VERSION) + || Bytes.equals(e.getKey(), FileInfo.MAX_TAGS_LEN)) { out.println(Bytes.toInt(e.getValue())); + } else if (Bytes.equals(e.getKey(), HStoreFile.MAJOR_COMPACTION_KEY) + || Bytes.equals(e.getKey(), FileInfo.TAGS_COMPRESSED) + || Bytes.equals(e.getKey(), HStoreFile.EXCLUDE_FROM_MINOR_COMPACTION_KEY)) { + out.println(Bytes.toBoolean(e.getValue())); + } else if (Bytes.equals(e.getKey(), FileInfo.LASTKEY)) { + out.println(new KeyValue.KeyOnlyKeyValue(e.getValue()).toString()); } else { out.println(Bytes.toStringBinary(e.getValue())); }
