lishijun121910 opened a new issue #7233:
URL: https://github.com/apache/shardingsphere/issues/7233


   #7229 # Which version of ShardingSphere did you use?
   
   4.1.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   When master node failed,  write operation all failed because timeout,  now 
change datasouce by zookeeper, sharding-jdbc receives datasource and rule 
changeevent , do write operations on new master, and service recover.
   
   ### Actual behavior
   
   hikari pool shutting down and no response on datasource and rule 
changeevent, stop all write operations and try again, shardingjdbc reload local 
configurations , not latest configurations in config-center.
   
   ### Reason analyze (If you can)
   
   no idea. 
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   
   1.initial configuration :
   
![image](https://user-images.githubusercontent.com/8045307/92086160-61687a80-edfc-11ea-81b4-33dab7a52309.png)
   
   2. start write operations
   
   3. kill master node :ds0
   
   4. write operations all fail:
   
![image](https://user-images.githubusercontent.com/8045307/92086313-9a085400-edfc-11ea-980d-6de5650f9bc5.png)
   
   5. stop write operations
   
   6. update master-slave rules on sharding-ui, use ds1 as new master:
   
![image](https://user-images.githubusercontent.com/8045307/92086418-bd330380-edfc-11ea-9276-81e98140f4e7.png)
   
   7. not working, still load local configurations:
   15:30:30.064 INFO  [tor-TreeCache-3] o.a.s.core.log.ConfigurationLogger - 
ShardingRuleConfiguration:
   masterSlaveRules:
     ms:
       loadBalanceAlgorithmType: ROUND_ROBIN
       masterDataSourceName: ds0
       name: ms
       slaveDataSourceNames:
       - ds1
       - ds2
   tables:
     T_MERCHANT:
       actualDataNodes: ms.T_MERCHANT${0..63}
       logicTable: T_MERCHANT
   
   15:30:30.064 INFO  [tor-TreeCache-3] o.a.s.core.log.ConfigurationLogger - 
Properties:
   sql.show: 'false'
   
   15:30:30.065 INFO  [tor-TreeCache-3] ShardingSphere-metadata - Loading 1 
logic tables' meta data.
   15:30:30.065 ERROR [tor-TreeCache-3] c.g.common.eventbus.EventBus.default - 
Exception thrown by subscrib
   er method 
renew(org.apache.shardingsphere.orchestration.core.common.event.DataSourceChangedEvent)
 on sub
   scriber 
org.apache.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationShardingDa
   taSource@51bf5add when dispatching event: 
org.apache.shardingsphere.orchestration.core.common.event.Data
   SourceChangedEvent@20a38bee
   java.lang.NullPointerException: null
   at 
org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:83)
           at 
org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.loadShardingSchemaMetaData(ShardingMetaDataLoader.java:134)
           at 
org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:125)
           at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.loadSchemaMetaData(ShardingRuntimeContext.java:65)
           at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.createMetaData(MultipleDataSourcesRuntimeContext.java:57)
           at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.<init>(MultipleDataSourcesRuntimeContext.java:51)
           at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.<init>(ShardingRuntimeContext.java:49)
           at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource.<init>(ShardingDataSource.java:54)
           at 
org.apache.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationShardingDataSource.renew(OrchestrationShardingDataSource.java:104)
           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 
com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:95)
           at 
com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:154)
           at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:80)
           at 
com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
           at 
com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:76)
           at 
com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:119)
           at com.google.common.eventbus.EventBus.post(EventBus.java:215)
           at 
org.apache.shardingsphere.orchestration.core.common.listener.PostShardingConfigCenterEventListener.lambda$watch$0(PostShardingConfigCenterEventListener.java:54)
           at 
org.apache.shardingsphere.orchestration.center.instance.CuratorZookeeperCenterRepository.lambda$watch$1(CuratorZookeeperCenterRepository.java:225)
           at 
org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:732)
           at 
org.apache.curator.framework.recipes.cache.TreeCache$2.apply(TreeCache.java:726)
           at 
org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:93)
           at 
com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:310)
           at 
org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:85)
           at 
org.apache.curator.framework.recipes.cache.TreeCache.callListeners(TreeCache.java:725)
           at 
org.apache.curator.framework.recipes.cache.TreeCache.access$1400(TreeCache.java:71)
           at 
org.apache.curator.framework.recipes.cache.TreeCache$4.run(TreeCache.java:843)
           at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   
   
   
   ### Example codes for reproduce this issue (such as a github link).
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to