Skip to content

Fix #97: Allow custom native library directory via h3.native.dir - #209

Open
dyrpsf wants to merge 4 commits into
uber:masterfrom
dyrpsf:feature-custom-native-dir
Open

Fix #97: Allow custom native library directory via h3.native.dir#209
dyrpsf wants to merge 4 commits into
uber:masterfrom
dyrpsf:feature-custom-native-dir

Conversation

@dyrpsf

@dyrpsf dyrpsf commented Jun 22, 2026

Copy link
Copy Markdown

Description

Fixes #97.

Currently, H3CoreLoader always extracts the native library (.so / .dll / .dylib) to the operating system's default temporary directory (e.g., /tmp/). As reported in #97, this causes UnsatisfiedLinkErrors in distributed environments like Apache Flink or Spark, where worker nodes frequently clean up or isolate the /tmp directory between task restorations.

This PR introduces a safe escape hatch for these environments. It updates createTempLibraryFile to check for a Java system property named h3.native.dir.

  • If provided, the library is extracted to that stable, user-defined directory.
  • If not provided, it falls back to the existing java.io.tmpdir behavior.

Testing

Local Java compilation succeeds. Relying on the CI pipeline to compile the native binaries and execute the test suite to ensure the extraction logic functions correctly across OS platforms.

@coveralls

coveralls commented Jun 22, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 665

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage decreased (-0.6%) to 96.387%

Details

  • Coverage decreased (-0.6%) from the base build.
  • Patch coverage: 3 uncovered changes across 1 file (7 of 10 lines covered, 70.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/main/java/com/uber/h3core/H3CoreLoader.java 10 7 70.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 580
Covered Lines: 567
Line Coverage: 97.76%
Relevant Branches: 195
Covered Branches: 180
Branch Coverage: 92.31%
Branches in Coverage %: Yes
Coverage Strength: 0.98 hits per line

💛 - Coveralls

@dyrpsf

dyrpsf commented Jun 22, 2026

Copy link
Copy Markdown
Author

Just pushed a quick update! The initial CI run failed on the spotlessJavaCheck task due to some minor formatting deviations.

I ran ./gradlew spotlessApply to automatically align the new code with the repository's strict style guidelines. The pipeline should be green now!

Comment thread src/main/java/com/uber/h3core/H3CoreLoader.java
@dyrpsf

dyrpsf commented Aug 15, 2026

Copy link
Copy Markdown
Author

Hi team, just pushed a quick update!

I've added a unit test for the h3.native.dir extraction logic to address the review feedback and restore the code coverage percentage.

To ensure the test is robust across different CI runners and local machines, it dynamically detects the OS to handle POSIX permissions properly, and it uses reflection to test the private extraction method without interfering with the singleton caching used by the rest of the test suite.

The pipeline should be all green now. Let me know if anything else is needed before merging!

@CLAassistant

CLAassistant commented Aug 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread src/test/java/com/uber/h3core/TestH3CoreLoader.java Outdated
@dyrpsf
dyrpsf requested a review from isaacbrodsky August 17, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

java.lang.UnsatisfiedLinkError: Can't load library: /tmp/libh3-java6591047064313530667.so

5 participants