HDFS-14348: Fix JNI exception handling issues in libhdfs#600
HDFS-14348: Fix JNI exception handling issues in libhdfs#600sahilTakiar wants to merge 4 commits intoapache:trunkfrom
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
Fixing cc warnings. |
|
💔 -1 overall
This message was automatically generated. |
|
|
||
| if (opts->byteBufferPool) { | ||
| // Delete any previous ByteBufferPool we had. | ||
| (*env)->DeleteGlobalRef(env, opts->byteBufferPool); |
There was a problem hiding this comment.
This should probably be moved down until right before setting the new value. Otherwise, if we failed somewhere below, we'd end up with two issues: (1) the function would return an error but had a side effect of clearing the previous value, which seems unintuitive. (2) the function would still leave opts->byteBufferPool set, but with a now-invalid reference.
There was a problem hiding this comment.
Done. Fixed a few other issues I found with this method while I was at it.
| jFileBlock = | ||
| (*env)->GetObjectArrayElement(env, jBlockLocations, i); | ||
| if (!jFileBlock) { | ||
| if ((*env)->ExceptionOccurred || !jFileBlock) { |
There was a problem hiding this comment.
this should be ExceptionOccurred(env), right? it's a function, not a variable, isn't it?
(same below a few places)
There was a problem hiding this comment.
Yeah, it definitely should be. Fixed.
|
💔 -1 overall
This message was automatically generated. |
* Fixed several issues in hadoopRzOptionsSetByteBufferPool * Fixed usage of ExceptionOccurred
|
💔 -1 overall
This message was automatically generated. |
| } else if (opts->byteBufferPool) { | ||
| // If the specified className is NULL, delete any previous | ||
| // ByteBufferPool we had. | ||
| (*env)->DeleteGlobalRef(env, opts->byteBufferPool); |
There was a problem hiding this comment.
need to also set it back to null, right?
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
This closes apache#600 Signed-off-by: Todd Lipcon <todd@apache.org> (cherry picked from commit fe29b39) Change-Id: I89af28e6006cfbde16897435150b1ae2d88c1c68 (cherry picked from commit dfd5401)
We should enable host affinity when RocksDB table is present, this should be done in RocksDB table provider. Author: Wei Song <wsong@linkedin.com> Reviewers: Prateek Maheshwari <pmaheshwari@linkedin.com> Closes apache#600 from weisong44/add-host-affinity and squashes the following commits: 78e1b84a [Wei Song] Enable host affinity in RocksDB table provider a15a7c9 [Wei Song] Merge remote-tracking branch 'upstream/master' 5cbf9af9 [Wei Song] Merge remote-tracking branch 'upstream/master' 3f7ed71 [Wei Song] Added self to committer list
This closes apache#600 Signed-off-by: Todd Lipcon <todd@apache.org> (cherry picked from commit fe29b39) Change-Id: I89af28e6006cfbde16897435150b1ae2d88c1c68
HDFS-14348 contains a list of all the JNI issues this patch fixes. All of the changes are related to proper exception handling when using the JNI library.
Some highlights:
hadoopRzOptionsSetByteBufferPoolwas changed to add proper exception handling forNewGlobalRefand to cleanup some of the logic that was missed in HDFS-14321get_current_thread_idwas re-written to use methods fromjni_helper.hrather than using the JNI library directly; this fixes several issues with exception handling that were present in the code