hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mauricio Morales (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-6656) Cannot call a Coprocessor Endpoint from a RegionObserver
Date Wed, 27 Nov 2013 17:41:38 GMT

    [ https://issues.apache.org/jira/browse/HBASE-6656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13833983#comment-13833983
] 

Mauricio Morales commented on HBASE-6656:
-----------------------------------------

I can understand and agree to that (this is an anti-pattern and should be avoided). I'm trying
to recall the details of the application back when we had this issue. To shed some more light
into this, we were trying to achieve an auto-indexing table. That is, basically, when you
insert into TABLE1, the put coprocessors would check and index the entries in TABLE1_index.


This can certainly be replaced by an offline indexer so we free the inline-coprocessor calls
altogether. We ended up discarding this solution due to performance issues (all the more reasons
to avoid coprocessors if possible).

> Cannot call a Coprocessor Endpoint from a RegionObserver
> --------------------------------------------------------
>
>                 Key: HBASE-6656
>                 URL: https://issues.apache.org/jira/browse/HBASE-6656
>             Project: HBase
>          Issue Type: Bug
>          Components: Coprocessors
>    Affects Versions: 0.92.1
>         Environment: CentOS5
>            Reporter: Mauricio Morales
>
> I'm trying to call a Coprocessor Endpoint from within the preGet handler of a RegionObserver,
and it's throwing Class Loader issues.
> The exact same Coprocessor Endpoint works perfectly from remote Java client, however,
fails from within the same Region Server.
> For our particular test environment, only 1 Region Server is available, so I guess it's
a "local" call that fails, and perhaps a remote RegionServer wouldn't fail, but that doesn't
justify the issue :).
> The Code within the RegionObserver is roughly (way reduced) as follows:
> ---
> 	@Override
> 	public void preGet(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<KeyValue>
results)
>      throws IOException {
> 		Map<byte[], Set<byte[]>> results;
> 		// scan: for all regions
> 		try {
> 			Batch.Call<PlatformStatsIndexEndpointProtocol,Set<byte[]>> batchCall =
new Batch.Call<PlatformStatsIndexEndpointProtocol,Set<byte[]>>() {
> 				  public Set<byte[]> call(PlatformStatsIndexEndpointProtocol instance) throws
IOException{
> 				    return instance.getKeyTokenByPrefix(index, match, additionalMatches);
> 				  }
> 				};
> 			results = indexTable.coprocessorExec(PlatformStatsIndexEndpointProtocol.class, null,
null, batchCall);
> 		} catch (Throwable e1) {
> 			e1.printStackTrace();
> 			throw new IOException(e1);
> 		}
> 		
> 		Set<byte[]> finalResultSet = new HashSet<byte[]>();
> 		for (Map.Entry<byte[], Set<byte[]>> e : results.entrySet()) {
> 			finalResultSet.addAll(e.getValue());
> 		}
> 	}
> ---
> The Code for the Coprocessor Endpoint is irrelevant, as it never gets executed.
> This is the Exception I get on the Client side (Server side logged exception below).
> ---
> Thu Aug 23 17:37:45 CST 2012, org.apache.hadoop.hbase.client.HTable$5@26659db7,java.io.IOException:
java.io.IOException: java.io.IOException: java.lang.IllegalArgumentException: interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
is not visible from class loader
>         at com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:100)
>         at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preGet(RegionCoprocessorHost.java:553)
>         at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3737)
>         at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3639)
>         at org.apache.hadoop.hbase.regionserver.HRegionServer.get(HRegionServer.java:1785)
>         at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:364)
>         at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1336)
> Caused by: java.io.IOException: java.lang.IllegalArgumentException: interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
is not visible from class loader
>         at com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokens(PlatformStatsIndexer.java:390)
>         at com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokensBySubstring(PlatformStatsIndexer.java:348)
>         at com.company.hbase.platformstats.IndexQueryRegionObserver.searchTokens(IndexQueryRegionObserver.java:148)
>         at com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:97)
>         ... 9 more
> Caused by: java.lang.IllegalArgumentException: interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
is not visible from class loader
>         at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
>         at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$4.call(HConnectionManager.java:1451)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getRegionServerWithRetries(HConnectionManager.java:1345)
>         at org.apache.hadoop.hbase.client.HTable.get(HTable.java:657)
>         at Test.queryIndex(Test.java:109)
>         at Test.main(Test.java:42)
> ---
> This is the Server Side exception logged:
> ---
> 2012-08-23 19:37:44,705 ERROR org.apache.hadoop.hbase.regionserver.HRegionServer:
> java.io.IOException: java.io.IOException: java.lang.IllegalArgumentException: interface
com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol is not
> visible from class loader
>         at com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:100)
>         at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preGet(RegionCoprocessorHost.java:553)
>         at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3737)
>         at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3639)
>         at org.apache.hadoop.hbase.regionserver.HRegionServer.get(HRegionServer.java:1785)
>         at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:364)
>         at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1336)
> Caused by: java.io.IOException: java.lang.IllegalArgumentException: interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
is not visible from class loader
>         at com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokens(PlatformStatsIndexer.java:390)
>         at com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokensBySubstring(PlatformStatsIndexer.java:348)
>         at com.company.hbase.platformstats.IndexQueryRegionObserver.searchTokens(IndexQueryRegionObserver.java:148)
>         at com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:97)
>         ... 9 more
> Caused by: java.lang.IllegalArgumentException: interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
is not visible from class loader
>         at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
>         at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$4.call(HConnectionManager.java:1451)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> ---
> I'm not senior java developer, so this Class Loader visibility issue goes beyond my reach.
I have the theory that because it's a local call, the ClassLoaders for the very same Protocol
interface may be different (1 reads from the .jar, another from the remote HTable client call);
but I have not been able to prove nor fix this behavior.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message