basho / riak-java-client

The Riak client for Java.
Apache License 2.0
266 stars 158 forks source link

Feature/add java 9 support #712

Closed bryanhuntesl closed 6 years ago

bryanhuntesl commented 6 years ago

Related Issue

711

How Has This Been Tested?

mvn test & mvn install

Types of changes

Checklist:

bryanhuntesl commented 6 years ago

So for info, the Travis failure is on 2.0.8 :

testCreateIndexTimeout(com.basho.riak.client.core.operations.itest.ITestYzAdminOperations)  Time elapsed: 5.645 sec  <<< FAILURE!
java.lang.AssertionError
    at com.basho.riak.client.core.operations.itest.ITestYzAdminOperations.testCreateIndexTimeout(ITestYzAdminOperations.java:171)

2.2.0 succeeds - wondering if it's worth investigating the failure on 2.0.8 or just to target the Java 9 support for 2.2 + ?

https://github.com/basho/riak-java-client/blob/b3139b68604080a52e874bce3ca6bd72f338ec71/src/test/java/com/basho/riak/client/core/operations/itest/ITestYzAdminOperations.java#L160-L175

jplock commented 6 years ago

Will this PR impact JDK8 support? I think targeting 2.2.0 makes sense to me as the team is actively working on a 2.2.5 release (then move on to 3.0.0).

bryanhuntesl commented 6 years ago

@jplock JDK8 will still be supported - maven is configured to generate java 8 bytecode .

Variable set here :

https://github.com/postbasho/riak-java-client/blob/cfc03334515e829d9861a4fd947a11f8d6c7f669/pom.xml#L72

And configuration here :

https://github.com/postbasho/riak-java-client/blob/cfc03334515e829d9861a4fd947a11f8d6c7f669/pom.xml#L362-L363

I've also added a couple of JDK to the travis test matrix (previously it was just Oracle 8) - I specifically added OpenJDK 8 as it's threading model is compliant but interleaving is different and can expose some subtle implementation bugs.

jdk:
  - oraclejdk8
  - oraclejdk9
  - openjdk8
bryanhuntesl commented 6 years ago

OK - build is failing on Java 9 - not because of my changes - but because Yokozuna (Riak running Java as a sub-process) starts it's Solr instance with the following args :

/usr/bin/java -Djava.awt.headless=true
-Djetty.home=/usr/lib/riak/lib/yokozuna-2.1.7-0-g6cf80ad/priv/solr
-Djetty.temp=/var/lib/riak/yz_temp
-Djetty.port=8093
-Dsolr.solr.home=/var/lib/riak/yz
-DhostContext=/internal_solr
-cp
/usr/lib/riak/lib/yokozuna-2.1.7-0-g6cf80ad/priv/solr/start.jar
-Dlog4j.configuration=file:///etc/riak/solr-log4j.properties
-Dyz.lib.dir=/usr/lib/riak/lib/yokozuna-2.1.7-0-g6cf80ad/priv/java_lib
-d64
-Xms1g
-Xmx1g
-XX:+UseStringCache
-XX:+UseCompressedOops
-Dcom.sun.management.jmxremote.port=8985
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
org.eclipse.jetty.start.Main

Here's the console output :

2018-02-27 11:43:03.503 [info] <0.590.0>@riak_core:wait_for_service:504 Waiting for service riak_kv to start (0 seconds)
2018-02-27 11:43:13.207 [info] <0.590.0>@riak_core:wait_for_service:498 Wait complete for service riak_kv (9 seconds)
2018-02-27 11:43:13.210 [info] <0.377.0>@riak_core:wait_for_service:498 Wait complete for service riak_kv (9 seconds)
2018-02-27 11:43:13.227 [info] <0.1896.0>@yz_solr_proc:ensure_data_dir:277 No solr config found, creating a new one
2018-02-27 11:43:13.229 [info] <0.1896.0>@yz_solr_proc:init:119 Starting solr: 
snip = ^^ see summary above ^^^^ 
2018-02-27 11:43:13.234 [info] <0.1896.0>@yz_solr_proc:handle_info:184 solr stdout/err: Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m
Unrecognized VM option 'UseStringCache'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

So the problem is not that the riak-java-client won't run on Java 9 - but that the default arguments used by Riak to start Yokozuna (Search) are incompatible with java version 9.

Created an issue to address this in yokozuna repo - suggest this p/r is good to merge.

bryanhuntesl commented 6 years ago

Thanks gents.