-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29850 Add support for dynamic per-request attributes in AsyncTable #7665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
HBASE-29850 Add support for dynamic per-request attributes in AsyncTable #7665
Conversation
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
So the requirements here is to use different request attribute for different requests? I think the design of the request attribute API is for static attributes, if we want to support dynamic attribute, we'd better redesign the APIs, like what you propose here, use a factory. Out of interest, what is your usage for this feature? Thanks. |
|
Yes—our requirement is to set a specific request attribute to a value calculated from thread-local context. We use This is exactly what we do with the |
Summary
Adds
RequestAttributesFactorytoAsyncTableBuilderfor generating request attributes dynamically per-request.Motivation
It is possible to do this for the HBase 2
Tableclient by overriding theRpcControllerFactoryon the connection, but that doesn't work reliably withAsyncTablebecause retries happen on Netty threads, losing thread-local context. This change provides a hook that is guaranteed to be called on the initiating thread.Changes
RequestAttributesFactoryinterface with a singlecreate(Map<String, byte[]>)methodsetRequestAttributesFactory()toAsyncTableBuilderget,put,scan,batch, etc.)getRequestAttributes()returns static attributes; factory is only used for actual requestsUsage