-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[branch-2] HBASE-27657: Connection and Request Attributes #5332
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
ab190fe
to
5622ef2
Compare
PR feedback: prefer emptyMap, no wildcard imports default attributes in Call constructor fix RpcClient in TestRpcBasedRegistryHedgedReads more test fixes request attributes support in tablebuilder cleanup checkstyle, banned imports PR feedback support setting a single req attribute remove plural attribute setter fix tests
3935bad
to
9183a02
Compare
💔 -1 overall
This message was automatically generated. |
9183a02
to
47e8c0f
Compare
💔 -1 overall
This message was automatically generated. |
more branch-2 compatibility
47e8c0f
to
37dec7e
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a first pass here and have our connection & request attribute tests passing. I'm going to look again with fresh eyes tomorrow.
new AsyncProcess(conn, conn.getConfiguration(), rpcCallerFactory, rpcFactory)); | ||
// todo rmattingly support buffered mutator request attributes | ||
new AsyncProcess(conn, conn.getConfiguration(), rpcCallerFactory, rpcFactory, | ||
Collections.emptyMap())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was an oversight not to implement request attribute support for the buffered mutator in #5326. I can introduce that here now and then port to master I will open another Jira to add this support separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to do this, will do before I mark as ready for review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this todo?
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java
Outdated
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java
Outdated
Show resolved
Hide resolved
public static void configureRequestAttributes(RpcController rpcController, | ||
Map<String, byte[]> requestAttributes) { | ||
if ( | ||
!requestAttributes.isEmpty() && rpcController != null | ||
&& rpcController instanceof HBaseRpcController | ||
) { | ||
HBaseRpcController controller = (HBaseRpcController) rpcController; | ||
controller.setRequestAttributes(requestAttributes); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could move this to the RpcControllerFactory; I originally put this here because I thought we'd need to configure request attributes in several places before finding the AsyncProcess class
...-server/src/test/java/org/apache/hadoop/hbase/client/TestRequestAndConnectionAttributes.java
Show resolved
Hide resolved
9444ac0
to
c6d7f29
Compare
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
Show resolved
Hide resolved
@@ -91,4 +107,9 @@ public static RpcControllerFactory instantiate(Configuration configuration) { | |||
return new RpcControllerFactory(configuration); | |||
} | |||
} | |||
|
|||
public RpcControllerFactory setRequestAttributes(Map<String, byte[]> requestAttributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like quite the departure from master branch impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'm not thrilled about it and it feels like an afterthought, but it's the least bad way that I've thought of so far. The master impl leans way more heavily into reusing controllers so just specifying on the controller is feasible. Meanwhile HTable calls rpcControllerFactory#newController
9 times, and that doesn't even account for multi requests. By specifying the attributes on the factory and leaning into AsyncProcess we achieve a way smaller diff than would otherwise be necessary. Very open to other suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend tracing how priority
is set.
For example, search for newController()
, one usage is in AsyncRequestFutureImpl
, getting passed into a MultiServerCallable (along with getPriority() val). Trace that constructor, both get passed through 3 super()
calls, down to RegionServerCallable
. Then in RegionServerCallable.call(int timeout)
method, a similar pattern to what happens in AsyncTable is seen -- the controller is reset and then setPriority is called.
Most of the other non-Admin usages of newController()
are in HTable and all are getting passed into various other subclasses of RegionServerCallable (NoncedRegionServerCallable, and ClientServiceCallable, etc). Those follow the similar pattern -- the controller and priority are passed into super calls down to RegionServerCallable.
So basically what you need to do is add Map<String, byte[]>
as an argument to RegionServerCallable constructor, and then update all of the subclasses to pass down from their various constructors. Yea, it's a bit more files changed, but mostly 1-2 line changes in each (except for HTable which is a 1-line change per newController() call).
This might distribute the LOC to more files than your current approach, but I think it's preferable because it keeps RpcControllerFactory clean between the 2 branches. I typically try to keep classes that exist in both branches as similar as possible, and then that sometimes leads to more duplication or re-implementation in the branch-2-only classes which is not great but more maintainable over time when cherry-picking changes between branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thoughtful reply here, that makes sense and I like the idea of preferring diffs in branch-specific classes. Ran out of time today, but will revisit this approach tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to self review, but I totally revisited the approach with this feedback in mind. thanks again!
c6d7f29
to
bb18bba
Compare
💔 -1 overall
This message was automatically generated. |
7e1761d
to
19f53ba
Compare
💔 -1 overall
This message was automatically generated. |
spotless failure seems like noise
|
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
198f2b4
to
af77aad
Compare
🎊 +1 overall
This message was automatically generated. |
@@ -142,6 +142,7 @@ public class BufferedMutatorImpl implements BufferedMutator { | |||
RpcControllerFactory rpcFactory, BufferedMutatorParams params) { | |||
this(conn, params, | |||
// puts need to track errors globally due to how the APIs currently work. | |||
// todo rmattingly support buffered mutator request attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i realized i was reviewing the wrong commits, so just saying again so its not lost -- can you remove this todo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java
Show resolved
Hide resolved
super(connection, tableName, row, rpcController, priority); | ||
RpcController rpcController, int priority, Map<String, byte[]> requestAttributes) { | ||
super(connection, tableName, row, | ||
HBaseRpcControllerImpl.configureRequestAttributes(rpcController, requestAttributes), priority, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. maybe its succeeding because of this. we should remove this in favor of my other comment
@@ -281,4 +282,16 @@ public String toString() { | |||
+ exception + ", regionInfo=" + regionInfo + ", priority=" + priority + ", cellScanner=" | |||
+ cellScanner + '}'; | |||
} | |||
|
|||
public static RpcController configureRequestAttributes(RpcController rpcController, | |||
Map<String, byte[]> requestAttributes) { // todo rmattingly delete? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please :D
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
we'll get another build here, but for posterity the above test failure looks like noise:
|
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went through the whole thing one more time. Looks good!
There are some changes to pluggable IA.Private and IA.LimitedPrivate class constructors, which I will document in the release notes for any users who are extending them.
…he#5332) Modifies upstream patch to add a shim constructor to BlockingRpcClient so we can migrate without incompatibilities Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
…he#5332) Modifies upstream patch to add a shim constructor to BlockingRpcClient so we can migrate without incompatibilities Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
…he#5332) Modifies upstream patch to add a shim constructor to BlockingRpcClient so we can migrate without incompatibilities Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
Backport of #5326
cc @bbeaudreault