-
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
HBASE-24650 Change the return types of the new checkAndMutate methods… #1991
Conversation
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've lost the context for a while, so these are only new methods, the old checkAndXXX methods are not effected?
* Represents a result of a CheckAndMutate operation | ||
*/ | ||
@InterfaceAudience.Public | ||
@InterfaceStability.Evolving |
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.
For IA.Public, we do not use the IS annotation since it should always be Stable.
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.
Okay. I will remove the IS annotation. Thanks.
@@ -349,7 +349,7 @@ private void preCheck() { | |||
loc, stub, mutation, | |||
(rn, rm) -> RequestConverter.buildMutateRequest(rn, row, family, qualifier, op, value, | |||
null, timeRange, rm), | |||
resp -> resp.getExists())) | |||
resp -> ((CheckAndMutateResult) resp).isSuccess())) |
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.
We have already make use of generic type so why here we still need to cast?
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 will modify it to make use of generic type. Thanks.
} | ||
|
||
// We need the MultiRequest when constructing the org.apache.hadoop.hbase.client.MultiResponse, | ||
// so here I write a new method as I do not want to change the abstraction of call method. | ||
private <RESP> CompletableFuture<RESP> mutateRow(HBaseRpcController controller, | ||
HRegionLocation loc, ClientService.Interface stub, RowMutations mutation, | ||
Converter<MultiRequest, byte[], RowMutations> reqConvert, | ||
Function<Result, RESP> respConverter) { | ||
Function<Object, RESP> respConverter) { |
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.
Object is too generic. Please explain why we need to do this change?
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.
The reason why I changed Result to Object here is that this method is used by both checkAndMutate() and mutateRow() and we need to use different types each case (respectively CheckAndMutateResult and Result). However as you mentioned, we can make use of generic type here. I will modify it. Thanks.
This comment has been minimized.
This comment has been minimized.
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.
Thank you for taking a look at this!
Yes, the old checkAndXXX methods are not effected. I'm going to add Increment/Append support to CheckAndMutate only for the new checkAndMutate methods.
* Represents a result of a CheckAndMutate operation | ||
*/ | ||
@InterfaceAudience.Public | ||
@InterfaceStability.Evolving |
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.
Okay. I will remove the IS annotation. Thanks.
@@ -349,7 +349,7 @@ private void preCheck() { | |||
loc, stub, mutation, | |||
(rn, rm) -> RequestConverter.buildMutateRequest(rn, row, family, qualifier, op, value, | |||
null, timeRange, rm), | |||
resp -> resp.getExists())) | |||
resp -> ((CheckAndMutateResult) resp).isSuccess())) |
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 will modify it to make use of generic type. Thanks.
} | ||
|
||
// We need the MultiRequest when constructing the org.apache.hadoop.hbase.client.MultiResponse, | ||
// so here I write a new method as I do not want to change the abstraction of call method. | ||
private <RESP> CompletableFuture<RESP> mutateRow(HBaseRpcController controller, | ||
HRegionLocation loc, ClientService.Interface stub, RowMutations mutation, | ||
Converter<MultiRequest, byte[], RowMutations> reqConvert, | ||
Function<Result, RESP> respConverter) { | ||
Function<Object, RESP> respConverter) { |
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.
The reason why I changed Result to Object here is that this method is used by both checkAndMutate() and mutateRow() and we need to use different types each case (respectively CheckAndMutateResult and Result). However as you mentioned, we can make use of generic type here. I will modify it. Thanks.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I modified the patch for the review and looks the QA is okay. @Apache9 Can you please review this? Thank you in advance. |
@Apache9 Please let me know if you have any questions about this. Thank you in advance. |
I missed that this had some checkstyle errors. I fixed the errors. |
Ping @Apache9. Thanks. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
return FutureUtils.get(table.checkAndMutate(checkAndMutate)); | ||
} | ||
|
||
@Override | ||
public boolean[] checkAndMutate(List<CheckAndMutate> checkAndMutates) throws IOException { | ||
return Booleans.toArray(FutureUtils.get(table.checkAndMutateAll(checkAndMutates))); | ||
public CheckAndMutateResult[] checkAndMutate(List<CheckAndMutate> checkAndMutates) |
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.
Better to return a List?
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 that's better. I will change it.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncTableImpl.java
Show resolved
Hide resolved
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.
@Apache9 Thank you for your comment.
I left some comments and I will modify this for your review.
return FutureUtils.get(table.checkAndMutate(checkAndMutate)); | ||
} | ||
|
||
@Override | ||
public boolean[] checkAndMutate(List<CheckAndMutate> checkAndMutates) throws IOException { | ||
return Booleans.toArray(FutureUtils.get(table.checkAndMutateAll(checkAndMutates))); | ||
public CheckAndMutateResult[] checkAndMutate(List<CheckAndMutate> checkAndMutates) |
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 that's better. I will change it.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncTableImpl.java
Show resolved
Hide resolved
… introduced in HBASE-8458
🎊 +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.
+1
… introduced in HBASE-8458