Hello,
I want to get a hang on implementing a postPut co-processor. A simple
test case is pretty much adding 1 to received cell values and store that
into a second HBase table. I basically have this here:
@Override
public void postPut(
final ObserverContext<RegionCoprocessorEnvironment> c
, final Put put
, final WALEdit edit
, final boolean writeToWAL
) throws IOException {
Map<byte[], List<KeyValue>> familyMap =
put.getFamilyMap();
RegionCoprocessorEnvironment e = c.getEnvironment();
if
(Arrays.equals(e.getRegion().getTableDesc().getName(),
Bytes.toBytes("t"))) {
List<KeyValue> kvs = familyMap.get("f1");
for (KeyValue kv : kvs) {
}
}
}
Now the question is how to process in the for loop to get the cell
value, increment the value by 1 and store that into a second HBase
table.
In general, I guess instantiating a HBase table should be at a central
point of my region observer class instead of the postPut implementation
etc ... Concrete examples on co-processors are rather rare, the only
useful thing I found were different coprocessor unit test classes, but
they don't go that far.
Thanks!
Thomas