-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-8458 Support for batch version of checkAndPut() and checkAndDel… #1320
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
Conversation
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.
hbase-client/src/main/java/org/apache/hadoop/hbase/CheckAndMutate.java
Outdated
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/CheckAndMutate.java
Outdated
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.
Looks very nice.
hbase-client/src/main/java/org/apache/hadoop/hbase/CheckAndMutate.java
Outdated
Show resolved
Hide resolved
*/ | ||
public Builder qualifier(byte[] qualifier) { | ||
this.qualifier = Preconditions.checkNotNull(qualifier, "qualifier is null. Consider using" + | ||
" an empty byte array, or just do not call this method if you want a null qualifier"); |
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.
Helpful precondition fail message.
On fail, it comes out ok? Back to the client?
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.
Back to the client. On fail, it will throw NullPointerException.
* @param value the expected value | ||
* @return the builder object | ||
*/ | ||
public Builder ifMatches(CompareOperator compareOp, byte[] value) { |
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.
s/ifMatches/ifCompares/?
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 already have the same name as this method in Table$CheckAndMutateBuilder and AsyncTable$CheckAndMutateBuilder, so I named this method as the same name.
Table$CheckAndMutateBuilder#ifMatches:
https://github.com/brfrn169/hbase/blob/f66cbe1a40cd9d4cd4abd27c7ac9d1a5168b885f/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java#L346
AsyncTable$CheckAndMutateBuilder#ifMatches:
https://github.com/brfrn169/hbase/blob/f66cbe1a40cd9d4cd4abd27c7ac9d1a5168b885f/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java#L269
hbase-client/src/main/java/org/apache/hadoop/hbase/CheckAndMutate.java
Outdated
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/RequestConverter.java
Show resolved
Hide resolved
} | ||
MutationProto mp = ProtobufUtil.toMutationNoData(type, mutation, mutationBuilder); | ||
cells.add(mutation); | ||
regionActionBuilder.addAction(actionBuilder.setMutation(mp).build()); | ||
} | ||
} | ||
|
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.
Argh. The old code was hard to decipher.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.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.
Thank you for reviewing this! @saintstack @HorizonNet
I will modify this patch and push a new patch.
*/ | ||
public Builder qualifier(byte[] qualifier) { | ||
this.qualifier = Preconditions.checkNotNull(qualifier, "qualifier is null. Consider using" + | ||
" an empty byte array, or just do not call this method if you want a null qualifier"); |
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.
Back to the client. On fail, it will throw NullPointerException.
hbase-client/src/main/java/org/apache/hadoop/hbase/CheckAndMutate.java
Outdated
Show resolved
Hide resolved
* @param value the expected value | ||
* @return the builder object | ||
*/ | ||
public Builder ifMatches(CompareOperator compareOp, byte[] value) { |
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 already have the same name as this method in Table$CheckAndMutateBuilder and AsyncTable$CheckAndMutateBuilder, so I named this method as the same name.
Table$CheckAndMutateBuilder#ifMatches:
https://github.com/brfrn169/hbase/blob/f66cbe1a40cd9d4cd4abd27c7ac9d1a5168b885f/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java#L346
AsyncTable$CheckAndMutateBuilder#ifMatches:
https://github.com/brfrn169/hbase/blob/f66cbe1a40cd9d4cd4abd27c7ac9d1a5168b885f/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java#L269
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java
Show resolved
Hide resolved
hbase-client/src/main/java/org/apache/hadoop/hbase/CheckAndMutate.java
Outdated
Show resolved
Hide resolved
* @param checkAndMutates The list of rows to apply. | ||
* @return A {@link CompletableFuture} that wrapper the result boolean list. | ||
*/ | ||
default CompletableFuture<List<Boolean>> checkAndMutateAll( |
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.
In AsyncTable, for methods returning List object, we provide 2 pattern methods returning List<CompletableFuture> and CompletableFuture<List>, and the latter's name is the former's name + "All".
For example, we already provide AsyncTable#get and AsyncTable#getAll:
https://github.com/brfrn169/hbase/blob/f66cbe1a40cd9d4cd4abd27c7ac9d1a5168b885f/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java#L452-L471
I did the same for checkAndMutate and checkAndMutateAll.
I added a new commit. In this commit, I did the following:
@saintstack @Apache9 @HorizonNet Could you please take look at this when you get a chance? |
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java
Show resolved
Hide resolved
I fixed some conflicts and added the Javadoc for the deprecation. Also, I re-ran QA. |
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.
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.
🎊 +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. |
Closing this. Will create another PR. |
…ete()