Add native access library (#105100)

Elasticsearch requires access to some native functions. Historically
this has been achieved with the JNA library. However, JNA is a
complicated, magical library, and has caused various problems booting
Elasticsearch over the years. The new Java Foreign Function and Memory
API allows access to call native functions directly from Java. It also
has the advantage of tight integration with hotspot which can improve
performance of these functions (though performance of Elasticsearch's
native calls has never been much of an issue since they are mostly at
boot time).

This commit adds a new native lib that is internal to Elasticsearch. It
is built to use the foreign function api starting with Java 21, and
continue using JNA with Java versions below that.

Only one function, checking whether Elasticsearch is running as root, is
migrated. Future changes will migrate other native functions.
This commit is contained in:
Ryan Ernst 2024-02-07 15:27:09 -08:00 committed by GitHub
parent 0022005e17
commit 6375e9f443
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 844 additions and 25 deletions

View file

@ -14,7 +14,7 @@ module org.elasticsearch.base {
exports org.elasticsearch.core;
exports org.elasticsearch.jdk;
exports org.elasticsearch.core.internal.provider to org.elasticsearch.xcontent;
exports org.elasticsearch.core.internal.provider to org.elasticsearch.xcontent, org.elasticsearch.nativeaccess;
uses ModuleQualifiedExportsService;
}