mongo-java-driver icon indicating copy to clipboard operation
mongo-java-driver copied to clipboard

Provide GraalVM metadata and substitutions

Open stIncMale opened this issue 1 year ago • 3 comments

I recommend reviewing the first four commits in this PR one at a time, as they are logically independent and don't conflict with each other.

  1. Moved native-image.properties to src/main/resources/META-INF/native-image/native-image.properties. Note how now they are immediately under the native-image folder.
  2. Ensured that MongoClient uses custom com.mongodb.spi.dns.DnsClientProviders in GraalVM via ServiceLoader.
  3. Moved driver-specific reachability metadata from :graalvm-native-image-app into the relevant driver JARs.
  4. Introduced GraalVM substitutions based on MongoClientSubstitutions in Quarkus. The introduced substitutions achieve the following: 4.1. Assert that substitutions are indeed used via Substitutions.assertUsed, which is called from NativeImageApp. 4.2. Explicitly throw at run time if UnixServerAddress is used. It allegedly does not work with GraalVM, we'll figure this out (or not) in JAVA-5400. 4.2. ~~Explicitly throw at run time if the Snappy compressor is used. I don't know why it allegedly does not work with GraalVM, we'll figure this out in JAVA-5383.~~

Note that I omitted some of Quarkus substitutions for various reasons:

JAVA-5219

stIncMale avatar Apr 03 '24 03:04 stIncMale

Hi, @cescoffier. I am unable to add you as a reviewer of this PR, but your review may be helpful. I am inviting you to take a look at this PR if you have time.

stIncMale avatar Apr 03 '24 04:04 stIncMale

LGTM except for the one that requires waiting for the next mongodb-crypt release.

jyemin avatar May 02 '24 17:05 jyemin

Converted to Draft PR while we await the mongodb-crypt release.

jyemin avatar May 07 '24 22:05 jyemin

FYI @stIncMale the mongodb-crypt release has been completed.

jyemin avatar Aug 13 '24 20:08 jyemin