Skip to content

Commit

Permalink
Make libjnifuse packaged in distribution
Browse files Browse the repository at this point in the history
This PR packages libjnifuse (both .so and . dylib) into `lib/` dir, and
add this dir to library path of fuse process by default.
benefits:
- Users can use libjnifuse without setting java library. When binary
tarball is downloaded, JNIFuse is configured and ready to use. There
will be no difference for Mac and Linux users.
- No need to separately copy libjnifuse.so in Dockerfile.fuse --- it
will be handled as part of Alluxio tarball

@maobaolong @cheyang , FYI

pr-link: Alluxio#12857
change-id: cid-13a9c990e850b7d60984131fa80a5535a0849bd4
  • Loading branch information
apc999 authored Feb 17, 2021
1 parent 84278df commit e54b51b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 29 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
**/alluxio-site.properties
**/nb-configuration*.xml
**/nbproject/
*.dylib
*.iml
*.pyc
*.so
*.swo
*.swp
*~
Expand Down Expand Up @@ -44,7 +42,7 @@
/integration/vagrant/vbox/.vagrant/
/integration/vagrant/vbox/alluxio-dev.box
/journal/
/lib/
/lib/*.jar
/logs/*.log*
/logs/*.out*
/logs/user/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ func addAdditionalFiles(srcPath, dstPath string, hadoopVersion version, version
"integration/docker/Dockerfile",
"integration/docker/Dockerfile.fuse",
"integration/docker/entrypoint.sh",
"integration/docker/libjnifuse.so",
"integration/fuse/bin/alluxio-fuse",
fmt.Sprintf("lib/alluxio-underfs-adl-%v.jar", version),
fmt.Sprintf("lib/alluxio-underfs-cos-%v.jar", version),
Expand All @@ -226,6 +225,8 @@ func addAdditionalFiles(srcPath, dstPath string, hadoopVersion version, version
fmt.Sprintf("lib/alluxio-integration-tools-hms-%v.jar", version),
fmt.Sprintf("lib/alluxio-integration-tools-validation-%v.jar", version),
"libexec/alluxio-config.sh",
"lib/libjnifuse.dylib",
"lib/libjnifuse.so",
"LICENSE",
}
if includeYarnIntegration(hadoopVersion) {
Expand Down
2 changes: 0 additions & 2 deletions integration/docker/Dockerfile.fuse
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ ARG ALLUXIO_UID=1000
ARG ALLUXIO_GID=1000
ARG ENABLE_DYNAMIC_USER=false

COPY libjnifuse.so /usr/lib/

RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository -y ppa:openjdk-r/ppa && \
apt-get update && \
Expand Down
26 changes: 3 additions & 23 deletions integration/fuse/bin/alluxio-fuse
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,9 @@ get_env() {
. ${ALLUXIO_LIBEXEC_DIR}/alluxio-config.sh

ALLUXIO_FUSE_JAR=${SCRIPT_DIR}/../target/alluxio-integration-fuse-${VERSION}-jar-with-dependencies.jar
FUSE_MAX_WRITE=131072
CLASSPATH=${CLASSPATH}:${ALLUXIO_FUSE_JAR}
}

check_java_version() {
local java_mjr_vers=$("${JAVA}" -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F'.' '{print $1 $2}')
if [[ ${java_mjr_vers} -lt 18 ]]; then
echo "You are running a version of Java which is older than Java 8.
Please use Java 8 to use alluxio-fuse" >&2
return 1
else
return 0
fi
}

check_fuse_jar() {
if ! [[ -f ${ALLUXIO_FUSE_JAR} ]]; then
echo "Cannot find ${ALLUXIO_FUSE_JAR}. Please compile alluxio with fuse profile and Java 8"
Expand All @@ -42,13 +30,6 @@ check_fuse_jar() {
fi
}

set_java_opt() {
JAVA_OPTS+=" -server -Xms1G -Xmx1G -XX:MaxDirectMemorySize=4g"

ALLUXIO_FUSE_JAVA_OPTS+=" ${ALLUXIO_JAVA_OPTS}"
ALLUXIO_FUSE_JAVA_OPTS+=" -Dalluxio.logger.type=FUSE_LOGGER"
}

mount_fuse() {
local mount_point=$1
local alluxio_root=$2
Expand All @@ -60,9 +41,9 @@ mount_fuse() {
fi

if [[ ${NO_DAEMON} -eq "1" ]]; then
# Assumes that the end of ALLUXIO_FUSE_JAVA_OPTS is -Dalluxio.logger.type=FUSE_LOGGER
ALLUXIO_FUSE_JAVA_OPTS+=",Console"
ALLUXIO_FUSE_JAVA_OPTS+=" -Dalluxio.logger.type=FUSE_LOGGER,Console"
fi

local cmd="${JAVA} -cp ${CLASSPATH} ${JAVA_OPTS} ${ALLUXIO_FUSE_JAVA_OPTS} \
alluxio.fuse.AlluxioFuse \
-o ${full_mount_option} \
Expand Down Expand Up @@ -139,8 +120,7 @@ if [[ $# -lt 1 ]]; then
fi

get_env
check_java_version && check_fuse_jar
set_java_opt
check_fuse_jar
if [[ $? -ne 0 ]]; then
exit 1
fi
Expand Down
Binary file added lib/libjnifuse.dylib
Binary file not shown.
File renamed without changes.
6 changes: 6 additions & 0 deletions libexec/alluxio-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; t
ALLUXIO_WORKER_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_WORKER_LOGGER"
fi

# FUSE specific parameters that will be shared to all workers based on ALLUXIO_JAVA_OPTS.
ALLUXIO_FUSE_JAVA_OPTS_DEFAULT=" -server -Xms1G -Xmx1G -XX:MaxDirectMemorySize=4g"
ALLUXIO_FUSE_JAVA_OPTS_DEFAULT+=" -Djava.library.path=${ALLUXIO_HOME}/lib"
ALLUXIO_FUSE_JAVA_OPTS_DEFAULT+=" -Dalluxio.logger.type=FUSE_LOGGER"
ALLUXIO_FUSE_JAVA_OPTS="${ALLUXIO_FUSE_JAVA_OPTS_DEFAULT} ${ALLUXIO_JAVA_OPTS} ${ALLUXIO_FUSE_JAVA_OPTS}"

# Log server specific parameters that will be passed to alluxio log server
ALLUXIO_LOGSERVER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_LOGSERVER_JAVA_OPTS+=" -Dalluxio.logserver.logger.type=LOGSERVER_LOGGER"
Expand Down

0 comments on commit e54b51b

Please sign in to comment.