Skip to content
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

WriteBufferManager JNI fixes #4579

Closed
wants to merge 7 commits into from
Closed

WriteBufferManager JNI fixes #4579

wants to merge 7 commits into from

Conversation

jbhati
Copy link
Contributor

@jbhati jbhati commented Oct 23, 2018

  1. WriteBufferManager should have a reference alive in Java side through Options/DBOptions otherwise, if it's GC'ed at java side, native side can seg fault.
  2. native method setWriteBufferManager() in DBOptions.java doesn't have it's jni method invocation in rocksdbjni which is added in this PR
  3. DBOptionsTest.java is referencing object of Options. Instead it should be testing against DBOptions. Seems like a copy paste error.
  4. Add a getter for WriteBufferManager.

…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
Copy link
Contributor

@benclay benclay left a comment

Choose a reason for hiding this comment

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

Can you add a bullet list to the PR body indicating what the problem was and high-level fixes included?

void Java_org_rocksdb_DBOptions_setWriteBufferManager(JNIEnv* /*env*/, jobject /*jobj*/,
jlong jdb_options_handle,
jlong jwrite_buffer_manager_handle) {
auto* write_buffer_manager =
Copy link
Contributor

Choose a reason for hiding this comment

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

Tabs are still a bit funny here

@jbhati
Copy link
Contributor Author

jbhati commented Oct 23, 2018

Problems in the master code are:

  1. WriteBufferManager should have a reference alive in Java side through Options/DBOptions otherwise, if it's GC'ed at java side, native side can seg fault.
  2. native method setWriteBufferManager() in DBOptions.java doesn't have it's jni method invocation inr rocksdbjni which is added in this PR
  3. DBOptionsTest.java is referencing object of Options. Instead it should be testing against DBOptions. Seems like a copy paste error.

return this;
}

@Override
public WriteBufferManager getWriteBufferManager() {
Copy link
Contributor

@sagar0 sagar0 Oct 24, 2018

Choose a reason for hiding this comment

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

This should be just writeBufferManager() to conform to the naming pattern of other getters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

return this;
}

@Override
public WriteBufferManager getWriteBufferManager() {
Copy link
Contributor

Choose a reason for hiding this comment

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

writeBufferManager().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done! at other places too

@sagar0 sagar0 changed the title Fix Plumbing WriteBufferManager through JNI WriteBufferManager JNI fixes Oct 24, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

mikekap pushed a commit to ladderlife/frocksdb that referenced this pull request Jun 27, 2019
Summary:
1. `WriteBufferManager` should have a reference alive in Java side through `Options`/`DBOptions` otherwise, if it's GC'ed at java side, native side can seg fault.
2. native method `setWriteBufferManager()` in `DBOptions.java` doesn't have it's jni method invocation in rocksdbjni which is added in this PR
3. `DBOptionsTest.java` is referencing object of `Options`. Instead it should be testing against `DBOptions`. Seems like a copy paste error.
4. Add a getter for WriteBufferManager.
Pull Request resolved: facebook/rocksdb#4579

Differential Revision: D10561150

Pulled By: sagar0

fbshipit-source-id: 139a15c7f051a9f77b4200215b88267b48fbc487
mikekap pushed a commit to ladderlife/frocksdb that referenced this pull request Jun 27, 2019
Summary:
1. `WriteBufferManager` should have a reference alive in Java side through `Options`/`DBOptions` otherwise, if it's GC'ed at java side, native side can seg fault.
2. native method `setWriteBufferManager()` in `DBOptions.java` doesn't have it's jni method invocation in rocksdbjni which is added in this PR
3. `DBOptionsTest.java` is referencing object of `Options`. Instead it should be testing against `DBOptions`. Seems like a copy paste error.
4. Add a getter for WriteBufferManager.
Pull Request resolved: facebook/rocksdb#4579

Differential Revision: D10561150

Pulled By: sagar0

fbshipit-source-id: 139a15c7f051a9f77b4200215b88267b48fbc487
Myasuka pushed a commit to Myasuka/frocksdb that referenced this pull request Oct 31, 2019
Summary:
1. `WriteBufferManager` should have a reference alive in Java side through `Options`/`DBOptions` otherwise, if it's GC'ed at java side, native side can seg fault.
2. native method `setWriteBufferManager()` in `DBOptions.java` doesn't have it's jni method invocation in rocksdbjni which is added in this PR
3. `DBOptionsTest.java` is referencing object of `Options`. Instead it should be testing against `DBOptions`. Seems like a copy paste error.
4. Add a getter for WriteBufferManager.
Pull Request resolved: facebook/rocksdb#4579

Differential Revision: D10561150

Pulled By: sagar0

fbshipit-source-id: 139a15c7f051a9f77b4200215b88267b48fbc487
StephanEwen pushed a commit to ververica/frocksdb that referenced this pull request Nov 21, 2019
Summary:
1. `WriteBufferManager` should have a reference alive in Java side through `Options`/`DBOptions` otherwise, if it's GC'ed at java side, native side can seg fault.
2. native method `setWriteBufferManager()` in `DBOptions.java` doesn't have it's jni method invocation in rocksdbjni which is added in this PR
3. `DBOptionsTest.java` is referencing object of `Options`. Instead it should be testing against `DBOptions`. Seems like a copy paste error.
4. Add a getter for WriteBufferManager.
Pull Request resolved: facebook/rocksdb#4579

Differential Revision: D10561150

Pulled By: sagar0

fbshipit-source-id: 139a15c7f051a9f77b4200215b88267b48fbc487
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.

None yet

4 participants