Java's Get() to directly return for NotFound#14095
Java's Get() to directly return for NotFound#14095siying wants to merge 2 commits intofacebook:mainfrom
Conversation
|
Hi @siying! Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention. You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
andrew-kryczka
left a comment
There was a problem hiding this comment.
@cbi42 do you have time to review?
This saves a lot of CPU for Java users.
The changes seem pretty mechanical - short circuits for IsNotFound() that do the same thing as the catch block would have done.
Summary: Right now, in Java's Get() calls, the way Get() is treated is inefficient. Status.NotFound is turned into an exception in the JNI layer, and is caught in the same function to turn into not found return. This causes significant overhead in the scenario where most of the queries ending up with not found. For example, in Spark's deduplication query, this exception creation overhead is higher than Get() itself. With the proposed change, if return status is NotFound, we directly return, rather than going through the exception path
Test Plan: Existing tests should cover all Get() cases, and they are passing.