HBase源代码调试(3)

HBase里面一个很重要的数据结构

hbase.client.Result

其中有一个private KeyValue[] kvs =null

KeyValue wraps a byte array and takes offsets and lengths into passed array at where to start interpreting the content as KeyValue. The KeyValue format inside a byte array is: <keylength> <valuelength> <key> <value> Key is further decomposed as:<rowlength> <row> <columnfamilylength> <columnfamily> <columnqualifier> <timestamp> <keytype>


当我们在客户端new HTable(conf, "testwy"), 会从meta文件搜索相关信息,并返回一个Result对象

当我们把此Result对象打印出来

keyvalues={testwy,,1356526985748.9c2583081c219f5331e7a80c5a63c244./info:regioninfo/1356526985844/Put/vlen=80/ts=0, testwy,,1356526985748.9c2583081c219f5331e7a80c5a63c244./info:server/1356526985935/Put/vlen=15/ts=0, testwy,,1356526985748.9c2583081c219f5331e7a80c5a63c244./info:serverstartcode/1356526985935/Put/vlen=8/ts=0}


 其中有三个keyvalue,结构都是

row/family:qualifier/timestamp/Type/vlen=(length of value)/ts=(memstore time stamp)

HRegionInfo.readFields function can analyse the string with 'info:regioninfo', to get the endkey, offLine, regionName, regionNameStr etc. member value.


		Put put = new Put(Bytes.toBytes("row1"));
		put.add(Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), Bytes.toBytes("val1"));
对应的 KeyValue值

[0, 0, 0, 28, 0, 0, 0, 4, 0, 4, 114, 111, 119, 49, 7, 99, 111, 108, 102, 97, 109, 49, 113, 117, 97, 108, 49, 127, -1, -1, -1, -1, -1, -1, -1, 4, 118, 97, 108, 49]




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值