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 2022/06/21 03:51:31 UTC

[GitHub] [shardingsphere] zjcnb opened a new issue, #18478: NPE occurred when `read-data-source-names` configured non-existent `ds`

zjcnb opened a new issue, #18478:
URL: https://github.com/apache/shardingsphere/issues/18478

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   `master`
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   `ShardingSphere-Proxy`
   
   
   ```
   java.lang.NullPointerException: Can not get connection from datasource read_ds_1.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:77)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:52)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection.createNewConnections(JDBCBackendConnection.java:101)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection.getConnections(JDBCBackendConnection.java:91)
   	at org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine.group(DriverExecutionPrepareEngine.java:82)
   	at org.apache.shardingsphere.infra.executor.sql.prepare.AbstractExecutionPrepareEngine.prepare(AbstractExecutionPrepareEngine.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:165)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:132)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:126)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:138)
   	at org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.UnicastResourceShowExecutor.execute(UnicastResourceShowExecutor.java:84)
   	at org.apache.shardingsphere.proxy.backend.text.admin.DatabaseAdminQueryBackendHandler.execute(DatabaseAdminQueryBackendHandler.java:56)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:95)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:108)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   ```
   
   ### Configuration
   
   ```
   databaseName: readwrite_splitting_db
   
   dataSources:
     write_ds:
       url: jdbc:mysql://127.0.0.1:3306/ds0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     read_ds_0:
       url: jdbc:mysql://127.0.0.1:3306/ds1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !READWRITE_SPLITTING
     dataSources:
       readwrite_ds:
         type: Static
         props:
           write-data-source-name: write_ds
           read-data-source-names: read_ds_0,read_ds_1
         loadBalancerName: random
     loadBalancers:
       random:
         type: RANDOM
   ```
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] zjcnb commented on issue #18478: NPE occurred when `read-data-source-names` configured non-existent `ds`

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #18478:
URL: https://github.com/apache/shardingsphere/issues/18478#issuecomment-1161224506

   Maybe need to check whether other feature has this problem.


-- 
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] susongyan commented on issue #18478: NPE occurred when `read-data-source-names` configured non-existent `ds`

Posted by GitBox <gi...@apache.org>.
susongyan commented on issue #18478:
URL: https://github.com/apache/shardingsphere/issues/18478#issuecomment-1188953698

   @zjcnb  only fix  npe in this case?     maybe ignore  non-existent ds or add pre assert


-- 
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] zjcnb commented on issue #18478: NPE occurred when `read-data-source-names` configured non-existent `ds`

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #18478:
URL: https://github.com/apache/shardingsphere/issues/18478#issuecomment-1188956211

   Yeah,you are right. Need to check ds non-exist too.
   
   
   
   发自我的iPhone
   
   
   ------------------ Original ------------------
   From: 亥时 ***@***.***&gt;
   Date: Tue,Jul 19,2022 7:47 PM
   To: apache/shardingsphere ***@***.***&gt;
   Cc: zhaojinchao ***@***.***&gt;, Mention ***@***.***&gt;
   Subject: Re: [apache/shardingsphere] NPE occurred when `read-data-source-names` configured non-existent `ds` (Issue #18478)
   
   
   
   
   
    
   @zjcnb  only fix  npe in this case?     maybe ignore  non-existent ds or add pre assert
    
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you were mentioned.Message ID: ***@***.***&gt;


-- 
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] strongduanmu closed issue #18478: NPE occurred when `read-data-source-names` configured non-existent `ds`

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #18478: NPE occurred when `read-data-source-names` configured non-existent `ds`
URL: https://github.com/apache/shardingsphere/issues/18478


-- 
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