[BEAM-4425] Force load JDBC drivers#5503
Conversation
|
|
||
| @Before | ||
| public void before() throws Exception { | ||
| Class.forName("org.apache.beam.sdk.extensions.sql.impl.JdbcDriver"); |
There was a problem hiding this comment.
I'd like to understand the environments that require this. What runtime do they have? This should be handled by the service file for java.sql.Driver in Java 7+. How do we test that path keeps working?
There was a problem hiding this comment.
If it varies on env, I think we'd need a test matrix. We used to have a bit but shut down our Travis job.
There was a problem hiding this comment.
TODO(me): when I am at the computers where it is broken, report my env to the JIRA.
|
I have not investigated at all, other than to apply the changes and run the tests. I can confirm tests now pass on my environment (macbook pro, high Sierra 10.13.4, Java 1.8.0_172-b11). Without them I saw: |
|
The tests pass without this change on Linux openjdk 1.8.0_131, OS X Sierra 10.12.6 with Java 1.8.0_141-b15, and OS X Sierra 10.12.6 upgraded to Java 1.8.0_172-b11. |
|
Interesting @apilloud - how are you launching the tests please to ensure we are equivalent? |
|
I think that might be it. I am running this: |
|
LGTM. The thing this is suppose to be testing isn't working, but the tests pass anyway because a bunch of other things also load the JDBC driver. I can repro this if I ensure the JdbcDriverTest is the first thing run. That makes it an ordering issue. |
|
w/o loading |
|
OK, merging to fix build and we should track in JIRA that the service loader pattern isn't working. |
In some environments (known to be OSX) the JDBC drivers are not loaded by the time they are used. This is a cherry-pick from #5490 to make it easy for anyone to review just these commits.
Follow this checklist to help us incorporate your contribution quickly and easily:
[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.It will help us expedite review of your Pull Request if you tag someone (e.g.
@username) to look at it.