smengcl opened a new pull request, #11636:
URL: https://github.com/apache/ozone/pull/11636

   Generated-by: Claude Code (Opus 5.5)
   
   ## What changes were proposed in this pull request?
   
   `NativeLibraryLoader` first tries `System.loadLibrary` for 
`ozone_rocksdb_tools`. The distribution's `lib/native` does not ship it, so it 
then extracts the library from `hdds-rocks-native-*.jar` into 
`native.lib.tmp.dir`. When that property is unset (no Ozone script sets it), 
the extraction directory is the current working directory.
   
   If the process cannot write to its working directory, extraction fails and 
the library is not loaded:
   
   ```
   WARN utils.NativeLibraryLoader: Unable to load library: ozone_rocksdb_tools
   java.nio.file.AccessDeniedException: 
/opt/hadoop/ozone_rocksdb_tools7373108702252003876
   WARN snapshot.SnapshotDiffManager: Native Library for raw sst file reading 
loading failed. Fallback to performing a full diff instead. ...
   ```
   
   This was hit in the compose runner image, where the OM runs in the read only 
mounted `/opt/hadoop`. Snapshot diff silently falls back to a full diff, and 
`ozone debug checknative` reports `rocks-tools: false`.
   
   Fix: when `native.lib.tmp.dir` is unset or empty, create the extraction 
directory with `Files.createTempDirectory(libraryName)`, i.e. under 
`java.io.tmpdir`. This matches RocksJava's own loader. An explicit 
`native.lib.tmp.dir` behaves as before, and cleanup via the existing shutdown 
hook is unchanged.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17155
   
   ## How was this patch tested?
   
   - `TestNativeLibraryLoader#testDummyLibrary` now expects the library under 
`java.io.tmpdir` when the property is null or empty. Without the fix those two 
cases fail; with it they pass. The explicit directory case still passes.
   - Native build (`-Drocks_tools_native`): `TestNativeLibraryLoader`, 
`TestManagedRawSSTFileIterator`, `TestLatestVersionedKWayMergeIterator` and 
`TestLatestVersionedKWayMergeIteratorOverSst` pass, and nothing is extracted 
into the module directory.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to