HBASE-682 Regularize toString
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@667295 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d2c38ff650
commit
4a04330d7f
|
@ -83,6 +83,7 @@ Hbase Change Log
|
||||||
HBASE-672 Sort regions in the regionserver UI
|
HBASE-672 Sort regions in the regionserver UI
|
||||||
HBASE-677 Make HTable, HRegion, HRegionServer, HStore, and HColumnDescriptor
|
HBASE-677 Make HTable, HRegion, HRegionServer, HStore, and HColumnDescriptor
|
||||||
subclassable (Clint Morgan via Stack)
|
subclassable (Clint Morgan via Stack)
|
||||||
|
HBASE-682 Regularize toString
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-47 Option to set TTL for columns in hbase
|
HBASE-47 Option to set TTL for columns in hbase
|
||||||
|
|
|
@ -93,6 +93,17 @@ public class HColumnDescriptor implements WritableComparable {
|
||||||
public static final BloomFilterDescriptor DEFAULT_BLOOM_FILTER_DESCRIPTOR =
|
public static final BloomFilterDescriptor DEFAULT_BLOOM_FILTER_DESCRIPTOR =
|
||||||
null;
|
null;
|
||||||
|
|
||||||
|
// Defines for jruby/shell
|
||||||
|
public static final String NAME = "NAME";
|
||||||
|
public static final String MAX_VERSIONS = "MAX_VERSIONS";
|
||||||
|
public static final String COMPRESSION = "COMPRESSION";
|
||||||
|
public static final String IN_MEMORY = "IN_MEMORY";
|
||||||
|
public static final String BLOCKCACHE = "BLOCKCACHE";
|
||||||
|
public static final String MAX_LENGTH = "MAX_LENGTH";
|
||||||
|
public static final String TTL = "TTL";
|
||||||
|
public static final String BLOOMFILTER = "BLOOMFILTER";
|
||||||
|
public static final String FOREVER = "FOREVER";
|
||||||
|
|
||||||
// Column family name
|
// Column family name
|
||||||
private byte [] name;
|
private byte [] name;
|
||||||
// Number of versions to keep
|
// Number of versions to keep
|
||||||
|
@ -289,16 +300,17 @@ public class HColumnDescriptor implements WritableComparable {
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{name: " + Bytes.toString(name) +
|
return "{" + NAME + " => '" + Bytes.toString(name) +
|
||||||
", max versions: " + maxVersions +
|
"', " + MAX_VERSIONS + " => " + maxVersions +
|
||||||
", compression: " + this.compressionType + ", in memory: " + inMemory +
|
", " + COMPRESSION + " => " + this.compressionType +
|
||||||
", block cache enabled: " + blockCacheEnabled +
|
", " + IN_MEMORY + " => " + inMemory +
|
||||||
", max length: " + maxValueLength +
|
", " + BLOCKCACHE + " => " + blockCacheEnabled +
|
||||||
", time to live: " +
|
", " + MAX_LENGTH + " => " + maxValueLength +
|
||||||
|
", " + TTL + " => " +
|
||||||
(timeToLive == HConstants.FOREVER ? "FOREVER" :
|
(timeToLive == HConstants.FOREVER ? "FOREVER" :
|
||||||
Integer.toString(timeToLive)) +
|
Integer.toString(timeToLive)) +
|
||||||
", bloom filter: " +
|
", " + BLOOMFILTER + " => " +
|
||||||
(bloomFilterSpecified ? bloomFilter.toString() : "none") +
|
(bloomFilterSpecified ? bloomFilter.toString() : CompressionType.NONE) +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ public class HTableDescriptor implements WritableComparable {
|
||||||
private byte [] name = HConstants.EMPTY_BYTE_ARRAY;
|
private byte [] name = HConstants.EMPTY_BYTE_ARRAY;
|
||||||
private String nameAsString = "";
|
private String nameAsString = "";
|
||||||
|
|
||||||
|
public static final String FAMILIES = "FAMILIES";
|
||||||
|
|
||||||
// Key is hash of the family name.
|
// Key is hash of the family name.
|
||||||
private final Map<Integer, HColumnDescriptor> families =
|
private final Map<Integer, HColumnDescriptor> families =
|
||||||
new HashMap<Integer, HColumnDescriptor>();
|
new HashMap<Integer, HColumnDescriptor>();
|
||||||
|
@ -189,8 +191,8 @@ public class HTableDescriptor implements WritableComparable {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "name: " + Bytes.toString(this.name) + ", families: " +
|
return HColumnDescriptor.NAME + " => '" + Bytes.toString(this.name) +
|
||||||
this.families.values();
|
"', " + FAMILIES + " => " + this.families.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
|
|
@ -172,9 +172,9 @@ abstract class BaseScanner extends Chore implements HConstants {
|
||||||
String serverName = Writables.cellToString(values.get(COL_SERVER));
|
String serverName = Writables.cellToString(values.get(COL_SERVER));
|
||||||
long startCode = Writables.cellToLong(values.get(COL_STARTCODE));
|
long startCode = Writables.cellToLong(values.get(COL_STARTCODE));
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug(Thread.currentThread().getName() + " regioninfo: {" +
|
LOG.debug(Thread.currentThread().getName() + " {" +
|
||||||
info.toString() + "}, server: " + serverName + ", startCode: " +
|
info.toString() + "}, SERVER => '" + serverName +
|
||||||
startCode);
|
"', STARTCODE => " + startCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note Region has been assigned.
|
// Note Region has been assigned.
|
||||||
|
|
|
@ -36,30 +36,4 @@ public class TestToString extends TestCase {
|
||||||
assertEquals("HServerInfo", "address: " + hostport + ", startcode: -1" +
|
assertEquals("HServerInfo", "address: " + hostport + ", startcode: -1" +
|
||||||
", load: (requests: 0 regions: 0)", info.toString());
|
", load: (requests: 0 regions: 0)", info.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test HTableDescriptor.toString();
|
|
||||||
*/
|
|
||||||
public void testHTableDescriptor() {
|
|
||||||
HTableDescriptor htd = HTableDescriptor.ROOT_TABLEDESC;
|
|
||||||
System. out.println(htd.toString());
|
|
||||||
assertEquals("Table descriptor", "name: -ROOT-, families: [{name: " +
|
|
||||||
"info, max versions: 1, compression: NONE, in memory: false, " +
|
|
||||||
"block cache enabled: false, max length: 2147483647, " +
|
|
||||||
"time to live: FOREVER, bloom filter: none}]", htd.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests HRegionInfo.toString()
|
|
||||||
*/
|
|
||||||
public void testHRegionInfo() {
|
|
||||||
HRegionInfo hri = HRegionInfo.ROOT_REGIONINFO;
|
|
||||||
System.out.println(hri.toString());
|
|
||||||
assertEquals("HRegionInfo",
|
|
||||||
"regionname: -ROOT-,,0, startKey: <>, endKey: <>, encodedName: 70236052, tableDesc: " +
|
|
||||||
"{name: -ROOT-, families: [{name: info, max versions: 1, " +
|
|
||||||
"compression: NONE, in memory: false, block cache enabled: false, " +
|
|
||||||
"max length: 2147483647, time to live: FOREVER, bloom filter: none}]}",
|
|
||||||
hri.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue