HDDS-15318. Download libhadoop library during maven build#10305
HDDS-15318. Download libhadoop library during maven build#10305ChenSammi wants to merge 4 commits into
Conversation
jojochuang
left a comment
There was a problem hiding this comment.
thanks for adding this!
| run mkdir -p ./lib/native | ||
|
|
||
| # Copy the files and symlinks safely | ||
| run cp -rP "${NATIVE_LIBS_DIR}/"libhadoop.* ./lib/native |
There was a problem hiding this comment.
will the ozone-env.sh script (or docker-config for our Docker deployments) need to set NATIVE_LIBS_DIR to lib/native for ozone to pick up libhadoop from this path?
There was a problem hiding this comment.
./lib/native doesn't always exists. But yes, I think ozone-env.sh or ozone.sh can auto add lib/native to java library path if it exists.
Co-authored-by: Wei-Chiu Chuang <jojochuang@gmail.com>
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @ChenSammi for the patch.
| </goals> | ||
| <phase>generate-resources</phase> | ||
| <configuration> | ||
| <url>https://archive.apache.org/dist/hadoop/common/hadoop-${hadoop.version}/hadoop-${hadoop.version}.tar.gz</url> |
There was a problem hiding this comment.
We should not download 500MB tarball for each build. Need to find a way to get these libs with less overhead.
There was a problem hiding this comment.
It only download once for every hadoop version locally. Maven will cache it. See above "How was this patch tested" section. And if -Pnative or -Pnative-mac is not enabled on maven build, it will not trigger the download.
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| <version>3.1.0</version> |
There was a problem hiding this comment.
| <version>3.1.0</version> |
| <plugin> | ||
| <groupId>com.googlecode.maven-download-plugin</groupId> | ||
| <artifactId>download-maven-plugin</artifactId> | ||
| <version>1.6.8</version> |
There was a problem hiding this comment.
Version (newer one) already defined.
| <version>1.6.8</version> |
There was a problem hiding this comment.
It's this version on feature branch. Next time, when merge master, it will be updated with master branch version.
| <plugin> | ||
| <groupId>com.googlecode.maven-download-plugin</groupId> | ||
| <artifactId>download-maven-plugin</artifactId> | ||
| <version>1.6.8</version> |
There was a problem hiding this comment.
| <version>1.6.8</version> |
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-antrun-plugin</artifactId> | ||
| <version>3.1.0</version> |
There was a problem hiding this comment.
| <version>3.1.0</version> |
| <id>native</id> | ||
| <activation> | ||
| <os> | ||
| <family>linux</family> | ||
| <arch>x86_64</arch> | ||
| </os> | ||
| <property> | ||
| <name>fetch-native-hadoop</name> | ||
| </property> | ||
| </activation> |
There was a problem hiding this comment.
Release manager may be using Mac or Linux, but needs to create package with lib for all supported platforms. I think these download/extract steps should be moved to existing dist profile (preferably in hadoop-ozone/dist/pom.xml).
There was a problem hiding this comment.
I did put it into dist pom.xml in first version. But there are at least two more packages (unit test and integration test) requires native library to run(not covered in this patch). So to avoid duplicate the profiles in multiple pom.xml, gemini suggests to put it in root pom.xml, and with inherited false.
There was a problem hiding this comment.
OK, if it's needed for tests, then keep it in root pom.xml, still, it should be platform-agnostic.
There was a problem hiding this comment.
What "it should be platform-agnostic" specific mean, can you elaborate it a bit more?
There was a problem hiding this comment.
What "it should be platform-agnostic" specific mean, can you elaborate it a bit more?
Build "needs to create package with lib for all supported platforms" regardless of which OS/arch it runs on.
There was a problem hiding this comment.
If both -Pnative and -Pnative-mac are enabled during maven build, the final package will have both linux native library and macos aarch64 library. Is this what you mean? Or what you mean is we have two dist ozone-2.1.0-SNAPSHOT directory, for example ozone-2.1.0-SNAPSHOT-x86-64, and ozone-2.1.0-SNAPSHOT-aarch64?
I think -Pnative is the main one for official release, -Pnative-mac is mainly for dev with mac environment. I don't expect we will release macos package officially.
There was a problem hiding this comment.
If both -Pnative and -Pnative-mac are enabled during maven build, the final package will have both linux native library and macos aarch64 library. Is this what you mean?
Yes.
I think -Pnative is the main one for official release, -Pnative-mac is mainly for dev with mac environment. I don't expect we will release macos package officially.
OK. (We do include some Mac/Windows native libs for Netty.)
There was a problem hiding this comment.
mvn clean package -DskipTests -Dmaven.javadoc.skip=true -s ~/workspace/tools/apache-maven-3.6.0/conf/settings-apache.xml -T 6 -Pdist,native,native-mac
sammi@X3HF9K66K7 target % ls -al ./ozone-2.1.0-SNAPSHOT/lib/native/
total 2056
drwxr-xr-x 6 sammi staff 192 May 19 23:17 .
drwxr-xr-x 3 sammi staff 96 May 19 23:17 ..
lrwxr-xr-x 1 sammi staff 28 May 19 23:17 libhadoop.dylib -> libhadoop_osx_aarch_64.dylib
lrwxr-xr-x 1 sammi staff 25 May 19 23:17 libhadoop.so -> libhadoop_linux_x86_64.so
-rw-r--r-- 1 sammi staff 890256 May 19 23:17 libhadoop_linux_x86_64.so
-rw-r--r-- 1 sammi staff 157368 May 19 23:17 libhadoop_osx_aarch_64.dylib
sammi@X3HF9K66K7 target % tar -tvf ozone-2.1.0-SNAPSHOT.tar.gz| grep libhadoop
lrwxr-xr-x 0 sammi staff 0 May 19 23:17 ozone-2.1.0-SNAPSHOT/lib/native/libhadoop.dylib -> libhadoop_osx_aarch_64.dylib
-rw-r--r-- 0 sammi staff 157368 May 19 23:17 ozone-2.1.0-SNAPSHOT/lib/native/libhadoop_osx_aarch_64.dylib
-rw-r--r-- 0 sammi staff 890256 May 19 23:17 ozone-2.1.0-SNAPSHOT/lib/native/libhadoop_linux_x86_64.so
lrwxr-xr-x 0 sammi staff 0 May 19 23:17 ozone-2.1.0-SNAPSHOT/lib/native/libhadoop.so -> libhadoop_linux_x86_64.so
What changes were proposed in this pull request?
download libhadoop library during maven build, for local unit test, and dist package.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15318
How was this patch tested?
Test locally.
The downloaded file in cached in maven local repo, so only download once if it's not changed.