You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by 某因幡 <te...@gmail.com> on 2012/08/22 14:27:42 UTC

Can I insert results in a coprocessor?

Hi, I tried to post process the result before the get requests return.
Is postGet the right place?
	@Override
	public void postGet(ObserverContext<RegionCoprocessorEnvironment> e,
			Get get, List<KeyValue> results) throws IOException {
		String table = e.getEnvironment().getRegion().getTableDesc()
				.getNameAsString();
		// if (table.compareTo(LOG_TABLE) != 0)
		// 	return;
		KeyValue hack = new KeyValue(get.getRow(), "x".getBytes(),
				"test".getBytes(), "hello".getBytes());
		results.add(hack);
	}

And this is the table.

hbase(main):001:0> describe 'test'
DESCRIPTION
                                     ENABLED
 {NAME => 'test', coprocessor$1 =>
'hdfs:///tmp/AccessLogRegionHelper.jar|com.test.AccessLogRegionHelper|',
true
  FAMILIES => [{NAME => 'r', BLOOMFILTER => 'NONE', REPLICATION_SCOPE
=> '0', VERSIONS => '3', COMPRESSION
 => 'SNAPPY', MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE =>
'65536', IN_MEMORY => 'false', BLOCKCA
 CHE => 'true'}, {NAME => 's', BLOOMFILTER => 'NONE',
REPLICATION_SCOPE => '0', COMPRESSION => 'SNAPPY', VE
 RSIONS => '3', TTL => '2147483647', MIN_VERSIONS => '0', BLOCKSIZE =>
'65536', IN_MEMORY => 'false', BLOCK
 CACHE => 'true'}, {NAME => 'x', BLOOMFILTER => 'NONE',
REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESS
 ION => 'SNAPPY', MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE
=> '65536', IN_MEMORY => 'false', BLO
 CKCACHE => 'true'}]}

But in JRuby shell scan won't print the key value pair I inserted in
the coprocessor.

Please figure out if I am on the right way.

-- 
language: Chinese, Japanese, English