hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 某因幡 <tewil...@gmail.com>
Subject Can I insert results in a coprocessor?
Date Wed, 22 Aug 2012 12:27:42 GMT
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

Mime
View raw message