HBase的协处理器问题,prePut函数无法触发。
来源:互联网 发布:问道手游sf源码 编辑:程序博客网 时间:2024/06/06 01:22
今天在使用HBase的协处理器的时候,遇到了问题,使用的是prePut方法,相当于触发器。从网上找了个例子,如下:
public class TestCoprocessor extends BaseRegionObserver {
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
final Put put, final WALEdit edit, final boolean writeToWAL)
throws IOException {
Configuration conf = new Configuration();
HTable table = new HTable(conf, "index_table");
List<KeyValue> kv = put.get("data".getBytes(), "name".getBytes());
Iterator<KeyValue> kvItor = kv.iterator();
while (kvItor.hasNext()) {
KeyValue tmp = kvItor.next();
Put indexPut = new Put(tmp.getValue());
indexPut.add("index".getBytes(), tmp.getRow(), Bytes.toBytes(System.currentTimeMillis()));
table.put(indexPut);
}
table.close();
}
}
打包成jar file,然后上传即可,详细的看这里:
http://www.aboutyun.com/thread-8857-1-1.html
可是怎么都成功不了,函数就是不触发。最后,发现,函数错了。用例子中的函数根本就不是覆盖。我这里用的是hbase0.98.6.
于是根据提示修改函数为:
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
Put put, WALEdit edit, Durability durability)
其他的不用变,这样才成功了。。。。。
- HBase的协处理器问题,prePut函数无法触发。
- Hbase的协处理器
- 关于HBase协处理器导致问题的研究
- 关于HBase协处理器导致问题的研究
- HBase学习之八:自定义hbase协处理器endpoint和遇到的问题
- HBase协处理器的一点皮毛知识
- HBase的协处理器编码实战
- hbase协处理器引发的问题解决方案
- HBase的协处理器编码实战
- HBase-6.hbase 协处理器
- Hbase--6 Hbase协处理器
- HBase的两种协处理器
- 【HBase】1009-HBase的协处理器(coprocessor)统计行数
- HBase协处理器
- hbase 协处理器
- HBase协处理器
- HBase--Coprocessor协处理器
- hbase 协处理器
- 输入一个非负整数,返回组成它的数字之和sum
- 基础总结篇之六:ContentProvider之读写联系人
- comparator接口与Comparable接口的区别
- DataReport使用手记
- Spring定时任务的几种实现
- HBase的协处理器问题,prePut函数无法触发。
- 手势识别(六)调节触摸到视图的传递
- UIView用户事件响应
- regular expression(2)
- 萌凤代码生成器&&解码器 ver.1.3
- group_concat函数详解
- PHP之转换编码格式
- Android开发:TCP和UDP传输
- fj域名,斐济域名的注册教程