-
Notifications
You must be signed in to change notification settings - Fork 6.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
RocksJava API - fix Transaction.multiGet() size limit, remove bogus EnsureLocalCapacity() calls #10674
RocksJava API - fix Transaction.multiGet() size limit, remove bogus EnsureLocalCapacity() calls #10674
Conversation
897a791
to
e522825
Compare
e522825
to
e7fe8af
Compare
b0adb4a
to
675ec7c
Compare
@see facebook#9006 Instances of RocksJava API JNI code appear to have misunderstood the reason for JNIEnv->EnsureLocalCapacity() and are carrying out bogus checks which happen to fail with some larger parameter values (many column familes in a single call, very long key names or values). Remove these checks and add some regression tests for the previous failures. Add/update tests to ensure that methods with EnsureLocalCapacity() removed still work; testing was perhaps a bit thin in places.
In conceptually similar (though not identical, APIs are a bit mismatched) way to standard multiGet, keys are now copied into jbyte[] so that local object references need only be held one at a time inside a loop.
Tests are systematic, write values to 10% of keys, handle duplicate keys (byte[] equality needs wrapped for proper value equals()).
675ec7c
to
caf62e9
Compare
@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
LGTM
@alanpaxton has updated the pull request. You must reimport the pull request before landing. |
@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Resolves @see #9006
Fixes 2 related issues with JNI local references in the RocksJava API.
Some instances of RocksJava API JNI code appear to have misunderstood the reason for
JNIEnv->EnsureLocalCapacity()
and are carrying out bogus checks which happen to fail with some larger parameter values (many column families in a single call, very long key names or values). Remove these checks and add some regression tests for the previous failures.The helper for Transaction multiGet operations (
multiGet()
,multiGetForUpdate()
,...) is limited in the number of keys it canget()
for because it requires a corresponding number of live local references. Refactor the helper slightly, copying out the key contents within a loop so that the references don't have to exist at the same time.