[
https://issues.apache.org/jira/browse/HADOOP-11887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14535359#comment-14535359
]
Colin Patrick McCabe commented on HADOOP-11887:
-----------------------------------------------
Thanks for updating the patch.
{code}
106 char* load_erasurecode_lib() {
107 static void* libec = NULL;
108 static char errMsg[1000];
109
110 if (libec != NULL) {
111 return NULL;
112 }
{code}
I really would prefer not to be using global buffers for error messages. How
about having the caller pass in a buffer and a size, and using snprintf to add
an error message if necessary? For example,
{code}
void do_stuff(char *err, size_t err_len)
{
if (problem with the foo) {
snprintf(err, err_len, "problem with the foo")
return;
}
err[0] = '\0'; // no error
}
{code}
{code}
63 /* A helper macro to dlsym the requisite dynamic symbol in NON-JNI env.
*/
64 #define LOAD_DYNAMIC_SYMBOL_NON_JNI(func_ptr, handle, symbol) \
65 if ((func_ptr = my_dlsym(handle, symbol)) == NULL) { \
66 return "Failed to load symbol" symbol; \
67 }
{code}
Even in a JNI environment, {{dlopen}} and {{dlsym}} still work the same way.
Our JNI code does use dlopen and dlsym in many cases to avoid a hard dependency
between {{libhadoop.so}} and the libraries that it makes use of. Suggest
renaming this simply to {{LOAD_DYNAMIC_SYMBOL}}.
Do you want to add the new unit test to the set of native unit tests? See the
pom.xml for hadoop-hdfs for an example:
{code}
<execution>
<id>native_tests</id>
<phase>test</phase>
<goals><goal>run</goal></goals>
<configuration>
<skip>${skipTests}</skip>
<target>
<property name="compile_classpath"
refid="maven.compile.classpath"/>
<property name="test_classpath"
refid="maven.test.classpath"/>
<macrodef name="run-test">
<attribute name="test"/>
<sequential>
<echo message="Running @{test}"/>
<exec
executable="${project.build.directory}/native/@{test}" failonerror="true"
dir="${project.build.directory}/native/">
<env key="CLASSPATH"
value="${test_classpath}:${compile_classpath}"/>
<!-- Make sure libhadoop.so is on LD_LIBRARY_PATH. -->
<env key="LD_LIBRARY_PATH"
value="${env.LD_LIBRARY_PATH}:${project.build.directory}/native/target/usr/local/lib:${hadoop.common.build.dir}/native/target/
usr/local/lib"/>
</exec>
<echo message="Finished @{test}"/>
</sequential>
</macrodef>
<run-test test="test_libhdfs_threaded"/>
<run-test test="test_libhdfs_zerocopy"/>
<run-test test="test_native_mini_dfs"/>
</target>
</configuration>
</execution>
{code}
> Introduce Intel ISA-L erasure coding library for the native support
> -------------------------------------------------------------------
>
> Key: HADOOP-11887
> URL: https://issues.apache.org/jira/browse/HADOOP-11887
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: io
> Reporter: Kai Zheng
> Assignee: Kai Zheng
> Attachments: HADOOP-11887-v1.patch, HADOOP-11887-v2.patch
>
>
> This is to introduce Intel ISA-L erasure coding library for the native
> support, via dynamic loading mechanism (dynamic module, like *.so in *nix and
> *.dll on Windows).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)