LuciferYang opened a new pull request, #12393:
URL: https://github.com/apache/gluten/pull/12393
### What changes were proposed in this pull request?
`JniLibLoader.loadAndCreateLink()` has an early-skip log line for libraries
that this instance has already loaded, but the branch forgets to `return` — so
`moveToWorkDir` and the symlink rebuild ran anyway. The sibling `load()` does
`return;` in the same branch, so the two methods diverged. This PR adds the
missing `return;` so the method mirrors `load()`, and adds a small Javadoc on
`loadAndCreateLink` pinning the contract ("same as load, plus a symlink;
returns immediately if already loaded") so the behaviour is documented rather
than only enforced by code-shape symmetry. ### Why are the changes needed?
Closes #12392. Because `System.load` itself is deduped via
`LOADED_LIBRARY_PATHS`, the bug does not cause a double native load — but on
every repeat call the library still gets re-extracted to the work directory and
the symlink delete+recreated. That is wasted I/O at best and a delete/recreate
race against any concurrent re
ader at worst. ### Does this PR introduce any user-facing change? No. ### How
was this patch tested? `mvn -pl gluten-core -Pspark-3.5 spotless:check` passes.
`mvn -pl gluten-core -Pspark-3.5 -Dtest=JniLibLoaderTest test` — the existing
`gluten-core` Java tests still pass. The fix is a 1-line behavioural alignment
with `load()` (already covered by usage); a dedicated reflection-based test was
considered but rejected to avoid coupling tests to the private
`loadedLibraries` field. Javadoc was added instead to document the contract.
--
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]