-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PR] Add support for native memory compression and decompression #311
Open
VladRodionov
wants to merge
30
commits into
luben:master
Choose a base branch
from
carrotdata:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
11c1c8f
added support for native memory compression
VladRodionov 909ad36
Merge branch 'master' of https://github.com/VladRodionov/zstd-jni
VladRodionov b904897
added artifact installation script to a local maven repo
VladRodionov e9da410
remove instal.sh
VladRodionov 04375ef
Merge branch 'luben:master' into master
VladRodionov 05f759c
to support multiplatform builds
VladRodionov 5ef09e1
Merge branch 'luben:master' into master
VladRodionov 1c4328d
Merge branch 'master' of https://github.com/carrotdata/zstd-jni
VladRodionov 7f40ab8
to support multiplatform build
VladRodionov a471754
to support multiplatform builds
VladRodionov ce41492
to support multiplatform builds
VladRodionov c75f02f
removed support binaries
VladRodionov f1b1e94
added instal_jar.sh
VladRodionov 5e12c5b
add os dependent script
cd407ee
Fix grammatical error
a63e0c0
Update README.md
VladRodionov 4a6c263
add repo for platform binaries
VladRodionov b3565ad
remove lib
VladRodionov 7718d7a
multiplatform support libraries
VladRodionov 9e183e3
Merge branch 'master' of https://github.com/carrotdata/zstd-jni
VladRodionov 3ad6ec4
multiplatform jar with libraries
VladRodionov 083a70f
Merge branch 'luben:master' into master
VladRodionov 702877a
Linux/aarch version with glibc 2.39 dependency
VladRodionov 5cc0d96
Merge branch 'master' of https://github.com/carrotdata/zstd-jni
VladRodionov 31e76d2
linux/amd64 with glibc 2.31
637d8e6
upgrade to 1.5.6-4
VladRodionov f77bab5
upgrade to 1.5.6-4
VladRodionov 808b7c0
upgrade to 1.5.6-4
VladRodionov 645e431
upgrade to 1.5.6-4
VladRodionov 7596eb5
Update README.md
VladRodionov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ project/plugins/project | |
.idea/ | ||
.bloop/ | ||
.metals/ | ||
.bsp/ | ||
tags | ||
local.properties | ||
zstd-jni.iml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
|
||
# Determine the OS type | ||
case "$(uname -s)" in | ||
Linux) | ||
OS_TYPE="linux" | ||
;; | ||
Darwin) | ||
OS_TYPE="darwin" | ||
;; | ||
MINGW32_NT* | MINGW64_NT*) | ||
OS_TYPE="win" | ||
;; | ||
*) | ||
echo "Unsupported OS" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Determine the architecture | ||
case "$(uname -m)" in | ||
x86_64) | ||
ARCH_TYPE="amd64" | ||
;; | ||
aarch64) | ||
ARCH_TYPE="aarch64" | ||
;; | ||
i386 | i686) | ||
ARCH_TYPE="i386" | ||
;; | ||
arm) | ||
ARCH_TYPE="arm" | ||
;; | ||
arm64) | ||
ARCH_TYPE="aarch64" | ||
;; | ||
ppc64) | ||
ARCH_TYPE="ppc64" | ||
;; | ||
mips64) | ||
ARCH_TYPE="mips64" | ||
;; | ||
s390x) | ||
ARCH_TYPE="s390x" | ||
;; | ||
riscv64) | ||
ARCH_TYPE="riscv64" | ||
;; | ||
loongarch64) | ||
ARCH_TYPE="loongarch64" | ||
;; | ||
*) | ||
echo "Unsupported architecture" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
echo Build for: | ||
echo OS_TYPE=$OS_TYPE | ||
echo ARCH_TYPE=$ARCH_TYPE | ||
|
||
# Define the directory and file pattern | ||
TARGET_DIR="./target" | ||
FILE_PATTERN="zstd-jni-*" | ||
|
||
# Find the jar file matching the pattern | ||
JAR_FILE=$(find "$TARGET_DIR" | grep ${FILE_PATTERN} | grep ${OS_TYPE} | grep ${ARCH_TYPE} | grep "\.jar") | ||
echo OS-Specific Artifact: $JAR_FILE | ||
|
||
# Check if the jar file exists | ||
if [[ -z "$JAR_FILE" ]]; then | ||
echo "Error: No jar file matching the pattern '$FILE_PATTERN' found in '$TARGET_DIR'." | ||
exit 1 | ||
fi | ||
|
||
# Extract the version from the jar file name | ||
VERSION=$(echo "$JAR_FILE" | sed -E 's/.*-([0-9]+\.[0-9]+\.[0-9]+-[0-9]+)-[^-]+\.jar/\1/') | ||
|
||
# Check if version was extracted successfully | ||
if [[ -z "$VERSION" ]]; then | ||
echo "Error: Unable to extract version from jar file name '$JAR_FILE'." | ||
exit 1 | ||
fi | ||
echo VERSION=$VERSION | ||
|
||
# Run the Maven install command with the extracted version | ||
echo "Installing zstd-jni library to the local maven repository" | ||
mvn install:install-file -Dfile="$JAR_FILE" -DgroupId=com.carrotdata -DartifactId=zstd-jni -Dversion="$VERSION" -Dpackaging=jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Define the directory and file pattern | ||
TARGET_DIR="./target" | ||
FILE_PATTERN="zstd-jni-*.jar" | ||
|
||
# Find the jar file matching the pattern | ||
JAR_FILE=$(find "$TARGET_DIR" -name "$FILE_PATTERN" -print -quit) | ||
|
||
# Check if the jar file exists | ||
if [[ -z "$JAR_FILE" ]]; then | ||
echo "Error: No jar file matching the pattern '$FILE_PATTERN' found in '$TARGET_DIR'." | ||
exit 1 | ||
fi | ||
|
||
# Extract the version from the jar file name | ||
VERSION=$(basename "$JAR_FILE" | sed -n 's/^zstd-jni-\(.*\)\.jar$/\1/p') | ||
|
||
# Check if version was extracted successfully | ||
if [[ -z "$VERSION" ]]; then | ||
echo "Error: Unable to extract version from jar file name '$JAR_FILE'." | ||
exit 1 | ||
fi | ||
|
||
# Run the Maven install command with the extracted version | ||
echo "Installing zstd-jni library to the local maven repository" | ||
mvn install:install-file -Dfile="$JAR_FILE" -DgroupId=com.carrotdata -DartifactId=zstd-jni -Dversion="$VERSION" -Dpackaging=jar |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this filename more descriptive and put a comment on top? Or just don't include it in the commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove this file from the commit. I had tried to add tests to this feature, but it has turned out that it's not that straightforward task. I had to enable
sun.misc.Unsafe
access to be able to allocate native memory and Scala (sbt) just makes this impossible (at least for me). I have zero experience in Scala and its tooling. In Java 9+ the access to this class is prohibited by default, so you have to specify additional command line args:java --add-opens jdk.unsupported/sun.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED
For some reason this does not work with
sbt
. Probably I did something wrong.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try to add these options to https://github.com/luben/zstd-jni/blob/master/build.sbt#L39 . I just pushed a change to run the tests in forked JVM so these options will apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recently moved repo fork to a new owner (organization) - https://github.com/carrotdata/zstd-jni/tree/master. The current PR is in some kind of a zombie state after that. I am going to close this PR and open new one, @luben . What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install-jar.sh
has been removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can continue on a new PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we can keep the old one. I removed
'install-jar.sh
and rebased it to theluben:master
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it was not so easy - forking broke builds on Windows and Mac OS, not sure why. So I reverted that