-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Refactor ColumnFamilyDescriptor to be RocksObject #12505
base: main
Are you sure you want to change the base?
Conversation
9a2c8af
to
624b2ae
Compare
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.
Some initial feedback...
@rhubner Do you also need to update the |
624b2ae
to
5cc529a
Compare
5cc529a
to
b0e5449
Compare
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.
I have suggested some minor changes.
I have chimed in on the issue raised by Adam about constructing new Java objects in the portal, I think you are basically correct there, and that option (2) is right. But see the details.
this.implicitlyCreatedColumnFamilyOptions = implicitlyCreatedColumnFamilyOptions; | ||
} | ||
|
||
private static long createNativeInstance(final byte[] columnFamilyName, |
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.
I would prefer to call this "createNativeDescriptor" - I think that makes it clearer.
*/ | ||
jbyteArray Java_org_rocksdb_ColumnFamilyDescriptor_getName( | ||
JNIEnv* env, jclass, jlong jcf_descriptor_handle) { | ||
auto cf_options = |
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.
Name should be cf_descriptor
*/ | ||
void Java_org_rocksdb_ColumnFamilyDescriptor_disposeJni( | ||
JNIEnv*, jclass, jlong jcf_descriptor_handle) { | ||
auto cf_options = |
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.
name cf_descriptor
jlong* jco = env->GetLongArrayElements(jcolumn_options, nullptr); | ||
if (jco == nullptr) { | ||
// exception thrown: OutOfMemoryError | ||
const jsize len_cols = env->GetArrayLength(jcf_descriptors); |
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.
This little code snippet (jcf_descriptors to std::vector) occurs in 3 or 4 places. Could it be a helper function in columnfamilydescriptor.cc ?
@@ -498,14 +497,13 @@ public static RocksDB openReadOnly(final DBOptions options, final String path, | |||
// in RocksDB can prevent Java to GC during the life-time of | |||
// the currently-created RocksDB. | |||
|
|||
final byte[][] cfNames = new byte[columnFamilyDescriptors.size()][]; | |||
final long[] cfOptionHandles = new long[columnFamilyDescriptors.size()]; | |||
final long[] cfDescriptorHandles = new long[columnFamilyDescriptors.size()]; |
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.
Conversion from List to
final long[] cfDescriptorHandles = new long[columnFamilyDescriptors.size()];
seems to happen in several places. Another candidate for a helper ?
Fix memory leak, see #12224 for details