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/01 14:27:32 UTC
[GitHub] [shardingsphere] lxl910128 opened a new issue #8459: test REPLICA QUERY by ShardingSphere-JDBC has a bug in version 5.0.0-alpha
lxl910128 opened a new issue #8459:
URL: https://github.com/apache/shardingsphere/issues/8459
Which version of ShardingSphere did you use?
5.0.0-alpha
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
I want to test the feature that "replica query". I created a spring project, Use the yml file to configure it.
When I config "load-balancers" like this:
```
spring:
shardingsphere:
rules:
replica-query:
data-sources:
pr_ds:
primary-data-source-name: ds_1
replica-data-source-names: ds_0
load-balancer-name: robin
load-balancers:
robin:
type: ROUND_ROBIN
```
I got a error!
```
2020-12-01 22:09:40.000 ERROR 16097 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_231]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_231]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_231]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_231]
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.v2(PropertyUtil.java:111) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-RC1-SNAPSHOT.jar:5.0.0-RC1-SNAPSHOT]
at org.apache.shardingsphere.spring.boot.util.PropertyUtil.handle(PropertyUtil.java:75) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-RC1-SNAPSHOT.jar:5.0.0-RC1-SNAPSHOT]
at org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.lambda$registerBean$1(AbstractAlgorithmProvidedBeanRegistry.java:57) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-RC1-SNAPSHOT.jar:5.0.0-RC1-SNAPSHOT]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_231]
at org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:55) ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-RC1-SNAPSHOT.jar:5.0.0-RC1-SNAPSHOT]
at org.apache.shardingsphere.replicaquery.spring.boot.algorithm.ReplicaQueryAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(ReplicaQueryAlgorithmProvidedBeanRegistry.java:43) ~[shardingsphere-replica-query-spring-boot-starter-5.0.0-RC1-SNAPSHOT.jar:5.0.0-RC1-SNAPSHOT]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271) ~[spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:121) ~[spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.0.13.RELEASE.jar:5.0.13.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
at club.gaiaproject.homework.source.DataSourceApplication.main(DataSourceApplication.java:24) [classes/:na]
Caused by: java.util.NoSuchElementException: No value bound
at org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:56) ~[spring-boot-2.0.9.RELEASE.jar:2.0.9.RELEASE]
... 21 common frames omitted
```
Through debug, I found that `ReplicaQueryAlgorithmProvidedBeanRegistry` calls the `registerBean`. In the `registerBean`, It will certainly look for it `xxx.props` like this
![image](https://user-images.githubusercontent.com/8736745/100751916-e3c80100-3422-11eb-8e9e-591441842a3f.png)
but in the [doc](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/configuration/built-in-algorithm/load-balance/)
ROUND_ROBIN don't have any Attributes.
so I must config like this:
```
spring:
shardingsphere:
rules:
replica-query:
data-sources:
pr_ds:
primary-data-source-name: ds_1
replica-data-source-names: ds_0
load-balancer-name: robin
load-balancers:
robin:
type: ROUND_ROBIN
props:
test: test
```
I think , It’s a bug, But I don't have a good idea to fix it.
----------------------------------------------------------------
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] lxl910128 closed issue #8459: test REPLICA QUERY by ShardingSphere-JDBC has a bug in version 5.0.0-alpha
Posted by GitBox <gi...@apache.org>.
lxl910128 closed issue #8459:
URL: https://github.com/apache/shardingsphere/issues/8459
----------------------------------------------------------------
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] lxl910128 commented on issue #8459: test REPLICA QUERY by ShardingSphere-JDBC has a bug in version 5.0.0-alpha
Posted by GitBox <gi...@apache.org>.
lxl910128 commented on issue #8459:
URL: https://github.com/apache/shardingsphere/issues/8459#issuecomment-736907800
Thanks for your answer. Wish better and better
----------------------------------------------------------------
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] yu199195 commented on issue #8459: test REPLICA QUERY by ShardingSphere-JDBC has a bug in version 5.0.0-alpha
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8459:
URL: https://github.com/apache/shardingsphere/issues/8459#issuecomment-736625535
@lxl910128 hi,you are right, in springboot maybe have this bug。 but we have to repair 。 you will see this :https://github.com/apache/shardingsphere/pull/8331
We will fix this problem completely in the next release
----------------------------------------------------------------
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