-
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
Plumb WriteBufferManager through JNI #4492
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up 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 the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
@sagar0 can you please review this pull request? Thanks in advance! :) |
Thanks! Can you please sign the CLA? |
@sagar0 Signed the CLA. Thanks |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@sagar0 ping :) |
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 good to me with a few minor suggestions.
Once they are handled I believe this will be in a good shape to be accepeted.
@@ -0,0 +1,38 @@ | |||
// Copyright (c) 2014, Vlad Balan (vlad.gm@gmail.com). All rights reserved. |
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.
// Copyright (c) 2014, Vlad Balan (vlad.gm@gmail.com). All rights reserved. | |
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
try (final Options opt = new Options()) { | ||
final Cache cache = new LRUCache(1 * 1024 * 1024); | ||
final long bufferSize = 2000l; | ||
final WriteBufferManager writeBufferManager = new WriteBufferManager(bufferSize, cache); |
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.
Lets move the instantiation of Cache and writeBufferManager (lines 430 - 432) also into the try block.
Same comment for the code change in OptionsTest as well.
try (final Options opt = new Options()) { | ||
final Cache cache = new LRUCache(1 * 1024 * 1024); | ||
final long bufferSize = 0l; | ||
final WriteBufferManager writeBufferManager = new WriteBufferManager(bufferSize, cache); |
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.
Lets move the instantiation of Cache and writeBufferManager also into the try block.
/** | ||
* Java wrapper over native write_buffer_manager class | ||
*/ | ||
public class WriteBufferManager extends RocksObject { |
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.
May be for later: others can contribute the remaining methods in native WriteBufferManager (like memroy_usage, FreeMem, etc).
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, maybe we will end up implementing it :)
I handled the travis and appveyor failures for you; those are green now. |
We don't do it a lot but users should be able to add themselves to https://github.com/facebook/rocksdb/blob/master/AUTHORS if they want. |
Feel free to update AUTHORS, but we need to ask lawyers about non-standard headers. |
In this particular case the copyright (and the surrounding author name) was a copy-paste error from merge_operator.cc/MergeOperator.java. |
Thanks for the quick review and taking care of the builds. Appreciate it @sagar0. Made the requested changes. It is reviewable again. |
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.
sagar0 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@sagar0 quick question. I applied this patch to our Manhattan database and I am getting the below runtime error. Was wondering if you know what might be wrong here? I have Block cache enabled and |
Never mind. Figured it out. Thanks. Will send a PR soon for the fix. |
…eBufferManager life as lifetime of Options Summary: Had bugs in PR: facebook#4492 which is fixed in this Test Plan: test cases Reviewers: bclay, sowmyalakshmip JIRA Issues: RTSG-3808 Differential Revision: https://phabricator.twitter.biz/D231875
Summary: Allow rocks java to explicitly create WriteBufferManager by plumbing it to the native code through JNI. Pull Request resolved: facebook/rocksdb#4492 Differential Revision: D10428506 Pulled By: sagar0 fbshipit-source-id: cd9dd8c2ef745a0303416b44e2080547bdcca1fd
Summary: Allow rocks java to explicitly create WriteBufferManager by plumbing it to the native code through JNI. Pull Request resolved: facebook/rocksdb#4492 Differential Revision: D10428506 Pulled By: sagar0 fbshipit-source-id: cd9dd8c2ef745a0303416b44e2080547bdcca1fd
Summary: Allow rocks java to explicitly create WriteBufferManager by plumbing it to the native code through JNI. Pull Request resolved: facebook/rocksdb#4492 Differential Revision: D10428506 Pulled By: sagar0 fbshipit-source-id: cd9dd8c2ef745a0303416b44e2080547bdcca1fd
Summary: Allow rocks java to explicitly create WriteBufferManager by plumbing it to the native code through JNI. Pull Request resolved: facebook/rocksdb#4492 Differential Revision: D10428506 Pulled By: sagar0 fbshipit-source-id: cd9dd8c2ef745a0303416b44e2080547bdcca1fd
Allow rocks java to explicitly create WriteBufferManager by plumbing it to the native code through JNI.