[
https://issues.apache.org/jira/browse/HBASE-27657?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bryan Beaudreault resolved HBASE-27657.
---------------------------------------
Fix Version/s: 2.6.0
3.0.0-beta-1
Release Note:
It is now possible to send Connection and Request attributes to the server.
Connection attributes are passed in via new method overloads in
ConnectionFactory. These attributes are only sent once per connection, during
connection handshake. They will remain in memory on the server side for the
duration of the connection.
Request attributes can be configured via a new setRequestAttributes on
TableBuilder and AsyncTableBuilder. Requests sent through the built table will
all send along the configured attributes. Each request sent to a RegionServer
will include the request attributes in the header. This differs from existing
Operation attributes for Scan (which doesn't accept operation attributes) and
Multi (which each operation in a batch has its own attributes).
These new attributes can be retrieved in server side plugins by inspecting
RpcServer.getCurrentCall(). The returned RpcCall has a getHeader(), which
returns the RequestHeader which has a getAttributeList() containing request
attributes. We also added a getConnectionHeader() to RpcCall, which also has a
getAttributeList() for getting connection attributes.
Note: This involved addition of a new Map<String, byte[]> argument to
ConnectionImplementation, AsyncConnectionImpl, NettyRpcClient, and
BlockingRpcClient. Users who have custom implementations of these Private and
LimitedPrivate classes will need to update their constructors accordingly to
match so that reflection continues to work.
Resolution: Fixed
> Connection and Request Attributes
> ---------------------------------
>
> Key: HBASE-27657
> URL: https://issues.apache.org/jira/browse/HBASE-27657
> Project: HBase
> Issue Type: New Feature
> Reporter: Bryan Beaudreault
> Assignee: Ray Mattingly
> Priority: Major
> Fix For: 2.6.0, 3.0.0-beta-1
>
>
> Currently we have the ability to set Operation attributes, via
> Get.setAttribute, etc. It would be useful to be able to set attributes at the
> request and connection level.
> These levels can result in less duplication. For example, send some
> attributes once per connection instead of for every one of the millions of
> requests a connection might send. Or send once for the request, instead of
> duplicating on every operation in a multi request.
> Additionally, the Connection and RequestHeader are more globally available on
> the server side. Both can be accessed via RpcServer.getCurrentCall(), which
> is useful in various integration points – coprocessors, custom queues,
> quotas, slow log, etc. Operation attributes are harder to access because you
> need to parse the raw Message into the appropriate type to get access to the
> getter.
> I was thinking adding two new methods to Connection interface:
> - setAttribute (and getAttribute/getAttributes)
> - setRequestAttributeProvider
> Any Connection attributes would be set onto the ConnectionHeader during
> initialization. The RequestAttributeProvider would be called when creating
> each RequestHeader.
> An alternative to setRequestAttributeProvider would be to add this into
> HBaseRpcController, which can already be customized via site configuration.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)