From 8620d2bdf9ddeaa28fd0f5ddce984c44025e02a7 Mon Sep 17 00:00:00 2001 From: James Clampffer Date: Fri, 16 Feb 2018 10:27:11 -0500 Subject: [PATCH] HDFS-12110: libhdfs++: Rebase HDFS-8707 on trunk, minor conflict resolution in this patch. Contributed by Deepak Majeti and Anatoli Shein. --- dev-support/docker/Dockerfile | 8 ++-- .../hadoop-hdfs-native-client/pom.xml | 44 +++++++++---------- .../src/CMakeLists.txt | 12 +---- .../src/main/native/libhdfspp/CMakeLists.txt | 5 ++- .../native/libhdfspp/lib/proto/CMakeLists.txt | 1 + .../main/native/libhdfspp/tests/hdfs_shim.c | 7 +++ .../libhdfspp/tests/libhdfs_wrapper_defines.h | 5 +++ .../libhdfspp/tests/libhdfs_wrapper_undefs.h | 5 +++ .../tests/libhdfspp_wrapper_defines.h | 5 +++ 9 files changed, 54 insertions(+), 38 deletions(-) diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile index 56db12a277..d6bf779a5f 100644 --- a/dev-support/docker/Dockerfile +++ b/dev-support/docker/Dockerfile @@ -38,7 +38,6 @@ ENV DEBCONF_TERSE true # WARNING: DO NOT PUT JAVA APPS HERE! Otherwise they will install default # Ubuntu Java. See Java section below! ###### -<<<<<<< 5f556eacf0fedbaec3cdb819847c7c6c3bacc048 RUN apt-get -q update && apt-get -q install -y \ apt-utils \ build-essential \ @@ -56,6 +55,7 @@ RUN apt-get -q update && apt-get -q install -y \ libfuse-dev \ libprotobuf-dev \ libprotoc-dev \ + libsasl2-dev \ libsnappy-dev \ libssl-dev \ libtool \ @@ -65,7 +65,6 @@ RUN apt-get -q update && apt-get -q install -y \ pkg-config \ python \ python2.7 \ - pylint \ python-pip \ python-pkg-resources \ python-setuptools \ @@ -74,8 +73,8 @@ RUN apt-get -q update && apt-get -q install -y \ software-properties-common \ snappy \ sudo \ - zlib1g-dev \ - valgrind + valgrind \ + zlib1g-dev ####### # OpenJDK 8 @@ -203,3 +202,4 @@ ENV FORREST_HOME=/opt/apache-forrest ADD hadoop_env_checks.sh /root/hadoop_env_checks.sh RUN chmod 755 /root/hadoop_env_checks.sh RUN echo '~/hadoop_env_checks.sh' >> /root/.bashrc + diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml b/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml index f596eac47e..52d9257f95 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml @@ -31,12 +31,12 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> false - hdfs false false + hdfs @@ -168,17 +168,21 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> run ${skipTests} - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -197,13 +201,13 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - org.apache.hadoop - hadoop-maven-plugins + org.apache.maven.plugins + maven-antrun-plugin - cmake-compile + make compile - cmake-compile + run @@ -217,12 +221,6 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - - - org.apache.maven.plugins - maven-antrun-plugin - native_tests test @@ -237,7 +235,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt index eaec0ecc38..a3f8f2d24a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt @@ -58,19 +58,11 @@ if(WIN32) # Omit unneeded headers. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") set(OS_DIR ${CMAKE_SOURCE_DIR}/main/native/libhdfs/os/windows) - - # IMPORTANT: OUT_DIR MUST be relative to maven's - # project.build.directory (=target) and match dist-copynativelibs - # in order to be in a release - set(OUT_DIR bin) + set(OUT_DIR target/bin) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") set(OS_DIR ${CMAKE_SOURCE_DIR}/main/native/libhdfs/os/posix) - - # IMPORTANT: OUT_DIR MUST be relative to maven's - # project.build.directory (=target) and match dist-copynativelibs - # in order to be in a release - set(OUT_DIR native/target/usr/local/lib) + set(OUT_DIR target/usr/local/lib) endif() # Configure JNI. diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt index e9d87c1562..94b1b56b20 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt @@ -35,7 +35,10 @@ SET(BUILD_SHARED_HDFSPP TRUE CACHE STRING "BUILD_SHARED_HDFSPP defaulting to 'TR SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) # If there's a better way to inform FindCyrusSASL.cmake, let's make this cleaner: -SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${CYRUS_SASL_DIR};${GSASL_DIR}") +SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${CYRUS_SASL_DIR};${GSASL_DIR};$ENV{PROTOBUF_HOME}") + +# Specify PROTOBUF_HOME so that find_package picks up the correct version +SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};$ENV{PROTOBUF_HOME}") find_package(Doxygen) find_package(OpenSSL REQUIRED) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt index a5b5c4cfcd..2eff30193d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt @@ -29,6 +29,7 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_HDFS_DIR}/hdfs.proto ${PROTO_HDFS_DIR}/inotify.proto ${PROTO_HDFS_DIR}/xattr.proto + ${PROTO_HDFS_DIR}/ReconfigurationProtocol.proto ${PROTO_HADOOP_DIR}/IpcConnectionContext.proto ${PROTO_HADOOP_DIR}/ProtobufRpcEngine.proto ${PROTO_HADOOP_DIR}/RpcHeader.proto diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_shim.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_shim.c index 1edfedc26c..54d4cf651e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_shim.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_shim.c @@ -470,6 +470,13 @@ void hadoopRzBufferFree(hdfsFile file, struct hadoopRzBuffer *buffer) { return libhdfs_hadoopRzBufferFree(file->libhdfsRep, buffer); } +int hdfsGetHedgedReadMetrics(hdfsFS fs, struct hdfsHedgedReadMetrics **metrics) { + return libhdfs_hdfsGetHedgedReadMetrics(fs->libhdfsRep, (struct libhdfs_hdfsHedgedReadMetrics **) metrics); +} + +void hdfsFreeHedgedReadMetrics(struct hdfsHedgedReadMetrics *metrics) { + return libhdfs_hdfsFreeHedgedReadMetrics((struct libhdfs_hdfsHedgedReadMetrics *) metrics); +} /************* * hdfs_ext functions diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_defines.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_defines.h index fcf3185961..b90776893f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_defines.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_defines.h @@ -90,3 +90,8 @@ #define kObjectKindDirectory libhdfs_kObjectKindDirectory #define hdfsReadStatistics libhdfs_hdfsReadStatistics #define hdfsFileInfo libhdfs_hdfsFileInfo +#define hdfsHedgedReadMetrics libhdfs_hdfsHedgedReadMetrics +#define hdfsGetHedgedReadMetrics libhdfs_hdfsGetHedgedReadMetrics +#define hdfsFreeHedgedReadMetrics libhdfs_hdfsFreeHedgedReadMetrics +#define hdfsStreamBuilderAlloc libhdfs_hdfsStreamBuilderAlloc +#define hdfsStreamBuilderBuild libhdfs_hdfsStreamBuilderBuild diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_undefs.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_undefs.h index 5a67fce625..fce0e823dd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_undefs.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfs_wrapper_undefs.h @@ -100,3 +100,8 @@ #undef hdfsRenameSnapshot #undef hdfsAllowSnapshot #undef hdfsDisallowSnapshot +#undef hdfsHedgedReadMetrics +#undef hdfsGetHedgedReadMetrics +#undef hdfsFreeHedgedReadMetrics +#undef hdfsStreamBuilderAlloc +#undef hdfsStreamBuilderBuild diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfspp_wrapper_defines.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfspp_wrapper_defines.h index c9bed90ed3..d0411c2126 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfspp_wrapper_defines.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/libhdfspp_wrapper_defines.h @@ -100,3 +100,8 @@ #define hdfsRenameSnapshot libhdfspp_hdfsRenameSnapshot #define hdfsAllowSnapshot libhdfspp_hdfsAllowSnapshot #define hdfsDisallowSnapshot libhdfspp_hdfsDisallowSnapshot +#define hdfsHedgedReadMetrics libhdfspp_hdfsHedgedReadMetrics +#define hdfsGetHedgedReadMetrics libhdfspp_hdfsGetHedgedReadMetrics +#define hdfsFreeHedgedReadMetrics libhdfspp_hdfsFreeHedgedReadMetrics +#define hdfsStreamBuilderAlloc libhdfspp_hdfsStreamBuilderAlloc +#define hdfsStreamBuilderBuild libhdfspp_hdfsStreamBuilderBuild