[
https://issues.apache.org/jira/browse/HBASE-5448?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary Helmling updated HBASE-5448:
---------------------------------
Attachment: HBASE-5448.patch
Here's a preliminary patch for discussion. The intent here is that all
coprocessor endpoints be defined and callable as protobuf services, so that we
no longer have endpoint invocations passed through as Writable blobs.
For coprocessor implementors, this means doing the following:
# Define the coprocessor service and related messages in a .proto file
# Run protoc to generate code
# Write code implementing:
#* the generated protobuf Service interface
#* the new org.apache.hadoop.hbase.coprocessor.CoprocessorService interface
(required for the RegionCoprocessorHost to register the exposed service)
With this done, clients can then call the new HTable.coprocessorService()
methods to perform the endpoint RPCs. This basically mirrors the current
HTable.coprocessorProxy() and HTable.coprocessorExec() calls.
I debated for a while how we could hide away details of the protobuf generated
service code from clients (i.e. Service methods take an RpcController instance
which isn't used in the HBase client). But it seems simpler to actually
embrace that aspect of the generated code and pass through any provided
RpcController where possible. As part
of this patch, I created an o.a.h.h.ipc.ServerRpcController implementation to
handle the RegionCoprocessorHost endpoint invocations. This facilitates
passing back exceptions to the RPC server. But it may make sense to genericize
this a bit more and allow clients to make use of the same implementation.
For clients, invocations now look something like:
{code:java}
HTable myTable = new HTable(conf, "mytable");
CoprocessorRpcChannel channel = myTable.coprocessorService(rowkey);
MyService.BlockingInterface service = MyService.newBlockingStub(channel);
MyCallRequest request = MyCallRequest.newBuilder()
...
.build();
MyCallResponse response = service.myCall(null, request);
{code}
Major changes in this patch are:
# CoprocessorProtocol and the associated HTable client methods
(coprocessorProxy, coprocessorExec) are now deprecated. The current
implementation allows both CoprocessorProxy and CoprocessorService
implementations to be registered side-by-side (even for the same class), so we
can have a full major-release cycle before dropping these.
# AccessController now defines and registers a PB-based Service.
TestAccessController is mostly converted to using this implementation in place
of AccessControllerProtocol.
# HRegionServer and HRegion define new execService() methods to handle the
invocations
This still needs some additional documentation and clean up, but I wanted to
get it out for some feedback on the direction for the exposed client interface.
Additional work to do:
# Convert other bundled CoprocessorProtocol-based implementations to PB-based
services. I think it's best to handle these in follow up issues.
# Some extra doc on the added classes
# Update org.apache.hadoop.hbase.coprocessor package javadoc with new usage
> Support for dynamic coprocessor endpoints with PB-based RPC
> -----------------------------------------------------------
>
> Key: HBASE-5448
> URL: https://issues.apache.org/jira/browse/HBASE-5448
> Project: HBase
> Issue Type: Sub-task
> Components: ipc, master, migration, regionserver
> Reporter: Todd Lipcon
> Assignee: Gary Helmling
> Attachments: HBASE-5448.patch
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira