You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/12/10 16:07:57 UTC
[GitHub] [shardingsphere] TeslaCN opened a new issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
TeslaCN opened a new issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570
## Question
There is a new property `exceptionOverrideClassName` in HikariCP 3.4.3. If the method `setExceptionOverrideClassName` was invoked with `null` value, NPE will occurred.
```yaml
[zk: zk36.zk.svc.cluster.local:2181(CONNECTED) 2] get /shardingsphere-governance/schemas/logic_db/datasource
dataSources:
dataSource:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
props:
password: postgres
transactionIsolation: null
connectionTestQuery: null
driverClassName: org.postgresql.Driver
jdbcUrl: jdbc:postgresql://pg.local.wwj.icu:5432/elasticjob
schema: null
dataSourceClassName: null
connectionTimeout: 30000
idleTimeout: 600000
exceptionOverrideClassName: null
username: postgres
dataSourceJNDI: null
initializationFailTimeout: 1
minimumIdle: 10
maxLifetime: 1800000
maximumPoolSize: 10
validationTimeout: 5000
leakDetectionThreshold: 0
connectionInitSql: null
poolName: HikariPool-1
catalog: null
```
```java
GovernanceCenterConfiguration centerConfiguration = getGovernanceCenterConfiguration();
GovernanceConfiguration governanceConfiguration = new GovernanceConfiguration("shardingsphere-governance", centerConfiguration, true);
DataSource dataSource = GovernanceShardingSphereDataSourceFactory.createDataSource(governanceConfiguration);
```
```
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:116)
at org.apache.shardingsphere.infra.config.datasource.DataSourceConverter.lambda$getDataSourceMap$0(DataSourceConverter.java:43)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.apache.shardingsphere.infra.config.datasource.DataSourceConverter.getDataSourceMap(DataSourceConverter.java:42)
at org.apache.shardingsphere.driver.governance.internal.datasource.GovernanceShardingSphereDataSource.createSchemaContexts(GovernanceShardingSphereDataSource.java:87)
at org.apache.shardingsphere.driver.governance.internal.datasource.GovernanceShardingSphereDataSource.<init>(GovernanceShardingSphereDataSource.java:64)
at org.apache.shardingsphere.driver.governance.api.GovernanceShardingSphereDataSourceFactory.createDataSource(GovernanceShardingSphereDataSourceFactory.java:83)
at icu.wwj.shardingsphere.GovernanceTest.assertUsingConfigCenterConfiguration(GovernanceTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: java.lang.NullPointerException
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at com.zaxxer.hikari.HikariConfig.attemptFromContextLoader(HikariConfig.java:945)
at com.zaxxer.hikari.HikariConfig.setExceptionOverrideClassName(HikariConfig.java:853)
... 42 more
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-748919895
Hi @TeslaCN
Is it likely that we set it as `null` in `DataSourceConfiguration` and sync to the registry? If so, we can consider setting it as another proper value before putting it into the registry. What do you think?
It looks like `DataSourcePreProcessor` has a similar function with `JDBCParameterDecorator` handling the parameters for different connection pools.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-749439673
Thanks for your inputs. @TeslaCN
@menghaoranss has a self-assigned, thanks for your joining.
We'd better fix this issue before the next release since it looks this one nagged many of our users.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-743027246
Hi @tristaZero ,
My idea is ignoring property with null value when converting a `DataSource` to `DataSourceConfiguration`. I don't know if there are any other effects.
Before:
```yaml
dataSources:
dataSource:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
props:
password: postgres
transactionIsolation: null
connectionTestQuery: null
driverClassName: org.postgresql.Driver
jdbcUrl: jdbc:postgresql://pg.local.wwj.icu:5432/elasticjob
schema: null
dataSourceClassName: null
connectionTimeout: 30000
idleTimeout: 600000
exceptionOverrideClassName: null
username: postgres
dataSourceJNDI: null
initializationFailTimeout: 1
minimumIdle: 10
maxLifetime: 1800000
maximumPoolSize: 10
validationTimeout: 5000
leakDetectionThreshold: 0
connectionInitSql: null
poolName: HikariPool-1
catalog: null
```
After:
```yaml
dataSources:
dataSource:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
props:
password: postgres
driverClassName: org.postgresql.Driver
jdbcUrl: jdbc:postgresql://pg.local.wwj.icu:5432/elasticjob
connectionTimeout: 30000
idleTimeout: 600000
username: postgres
initializationFailTimeout: 1
minimumIdle: 10
maxLifetime: 1800000
maximumPoolSize: 10
validationTimeout: 5000
leakDetectionThreshold: 0
poolName: HikariPool-1
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN edited a comment on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
TeslaCN edited a comment on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-748951572
Hi @tristaZero
IMO, the only difference between `DataSourcePreProcessor` and `JDBCParameterDecorator` is they work on different phases. Indeed we can provide a proper value for this property, but we need to decide when and where.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-744170186
How about we give `exceptionOverrideClassName` a specific or default value to adapt to the HikariCP >=3.4.3?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss closed issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
menghaoranss closed issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-748951572
Hi @tristaZero
IMO, the only difference between `DataSourcePreProcessor` and `JDBCParameterDecorator` is they work on different phases. Indeed we can provide a proper value for this property, but we need to decide when.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yinyanghuafa commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
yinyanghuafa commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-747833620
When HikariCP < 3.4.3,does it work?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-742954072
Hi @TeslaCN ,
Thanks for this issue. I suppose it is a bug. Do you have any idea to solve this one?
Here is a quick intro concerning converting a `DataSource` to a **Literal** `DataSource` saved in the registry later. We can consider fixing it in `DataSourceConfiguration.java` or `DataSourceConfigurationYamlSwapper.java`.
A `dataSource` will firstly be converted to [DataSourceConfiguration](https://github.com/apache/shardingsphere/blob/master/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConfiguration.java), and then its **Literal** value will be generated by [DataSourceConfigurationYamlSwapper](https://github.com/apache/shardingsphere/blob/master/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/DataSourceConfigurationYamlSwapper.java).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-747128764
Maybe we can define a new SPI like `DataSourcePreProcessor` to do something before setting attributes on the `DataSource`. This way the `DataSourceConfiguration` won't have to sense `DataSource Type`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yinyanghuafa commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
yinyanghuafa commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-747843419
I also met the problem.
5.0.0-RC1-SNAPSHOT
springboot 2.3.4
HikariCp 3.4.5
init datasource failed
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
menghaoranss commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-886343458
fixes by #10586
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-744271730
> How about we give `exceptionOverrideClassName` a specific or default value to adapt to the HikariCP >=3.4.3?
Where can we write the assignment statement? The exception occurs before `JDBCParameterDecorator`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-745039497
About `DataSourceConfiguration`, do you mean `Driver Types` or `DataSource Type`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-745181778
Sorry, exactly speaking, `DataSourceConfiguration` will know some of the `JDBC connection pool`. Since we will put a Map<poolType, List<Properties>, like `Map<hikari, List< exceptionOverrideClassName>>`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on issue #8570: shardingsphere-jdbc-governance incompatible with HikariCP >= 3.4.3
Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #8570:
URL: https://github.com/apache/shardingsphere/issues/8570#issuecomment-745037915
IMO, there are two methods to deal with this one.
### DataSourceConfiguration
Like `SKIPPED_PROPERTY_NAMES`, it is possible to add a Map<DriverType, List<Properties>> to set an appropriate value for these particular properties. But this way will make `DataSourceConfiguration` senses `Driver Types`.
### HikariJDBCParameterDecorator
That's a specific class to decorate properties to `HikariCP`, a proper place to do some exclusive works for a certain Driver pool. So we can give `exceptionOverrideClassName` a proper value here. Meanwhile, we have to move this class from `proxy` module to maybe `infra` module.
For me, I prefer the first one to avoid the impact of other setting operations in `HikariJDBCParameterDecorator`. What do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org