Skip to content

Java's Get() to directly return for NotFound#14095

Closed
siying wants to merge 2 commits intofacebook:mainfrom
siying:patch-2
Closed

Java's Get() to directly return for NotFound#14095
siying wants to merge 2 commits intofacebook:mainfrom
siying:patch-2

Conversation

@siying
Copy link
Contributor

@siying siying commented Oct 30, 2025

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.

@meta-cla
Copy link

meta-cla bot commented Oct 30, 2025

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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Nov 4, 2025
@siying siying changed the title WIP Java's Get() to directly return for NotFound Nov 5, 2025
Copy link
Contributor

@andrew-kryczka andrew-kryczka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@andrew-kryczka andrew-kryczka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@meta-codesync
Copy link

meta-codesync bot commented Nov 11, 2025

@cbi42 has imported this pull request. If you are a Meta employee, you can view this in D86797594.

Copy link
Contributor

@cbi42 cbi42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@meta-codesync meta-codesync bot closed this in c757f5b Nov 12, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 12, 2025

@cbi42 merged this pull request in c757f5b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants