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/07 14:25:37 UTC

[GitHub] [shardingsphere] zhangwei1989 opened a new issue #8525: NullPointerException: Can not get connection from datasource pr_ds

zhangwei1989 opened a new issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525


   ## Question
   
   Following is my situation:
   1. MacOS 10.14.6
   2. Mysql 5.7 running in Docker with three seperate container
   3. apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy-bin
   
   Sharding-proxy was started without any problem, for i got the log:
   `[INFO ] 22:09:26.946 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success.`
   
   But when I run `show tables;` in mysql-cli, I got the following error logs:
   
   ```
   [ERROR] 22:10:25.712 [ShardingSphere-Command-5] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	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)
   ```
   
   My server.yaml is shown below:
   
   ```
   authentication:
    users:
      root:
        password: root
      sharding:
        password: sharding 
        authorizedSchemas: sharding_db
   
   props:
    max-connections-size-per-query: 1
    acceptor-size: 16  # The default value is available processors count * 2.
    executor-size: 16  # Infinite by default.
    proxy-frontend-flush-threshold: 128  # The default value is 128.
      # LOCAL: Proxy will run with LOCAL transaction.
      # XA: Proxy will run with XA transaction.
      # BASE: Proxy will run with B.A.S.E transaction.
    proxy-transaction-type: LOCAL
    proxy-opentracing-enabled: false
    proxy-hint-enabled: false
    query-with-cipher-column: true
    sql-show: false
    check-table-metadata-enabled: false
   ```
   
   And the url in the config-replica-query.yaml can be connected successfully with local mysql-cli. My config-replica-query.yaml is shown below:
   
   ```
   schemaName: replica_query_db
   
   dataSourceCommon:
    username: root
    password: admin123
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
    maintenanceIntervalMilliseconds: 30000
   
   dataSources:
    primary_ds:
      url: jdbc:mysql://192.168.99.100:3316/db?serverTimezone=UTC&useSSL=false
    replica_ds_0:
      url: jdbc:mysql://192.168.99.100:3326/db?serverTimezone=UTC&useSSL=false
    replica_ds_1:
      url: jdbc:mysql://192.168.99.100:3336/db?serverTimezone=UTC&useSSL=false
   
   rules:
   - !REPLICA_QUERY
    dataSources:
      pr_ds:
        name: pr_ds
        primaryDataSourceName: primary_ds
        replicaDataSourceNames:
          - replica_ds_0
          - replica_ds_1
   ```
   At last, mysql-connector-java-5.1.47.jar was in the folder with the name of ext-lib.
   
   I read documentation, searched open and closed issues, but I still can't figure out how to fix this. Can give me some tips?
   
   Thanks a lot!
   


----------------------------------------------------------------
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] zhangwei1989 commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @tristaZero,
   
   It's the debug log:
   
   - It entered into AllSQLRouteExecutor instead of PartialSQLRouteExecutor.
   ![HTTPClient结果](http://zhangwei1989.oss-cn-beijing.aliyuncs.com/2020-12-12-WechatIMG1110.jpeg)
   - It never entered into ReplicaQuerySQLRouter, so I can't find out why return pr_ds.
   
   What can I do to debug next?
   
   Thanks o lot~
   
   
    


----------------------------------------------------------------
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] zhangwei1989 commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @tristaZero ,
   
   The relative log is shown below:
   
   ```
   [INFO ] 19:42:07.377 [main] ShardingSphere-metadata - Loading 2 tables' meta data for unconfigured tables.
   [INFO ] 19:42:07.388 [main] ShardingSphere-metadata - Loading 2 tables' meta data for unconfigured tables.
   [INFO ] 19:42:07.390 [main] ShardingSphere-metadata - Loading 2 tables' meta data for unconfigured tables.
   [INFO ] 19:42:07.397 [main] ShardingSphere-metadata - Loading 2 tables' meta data for unconfigured tables.
   [INFO ] 19:42:07.399 [main] ShardingSphere-metadata - Loading 2 tables' meta data for unconfigured tables.
   [INFO ] 19:42:07.400 [main] ShardingSphere-metadata - Loading 2 tables' meta data for unconfigured tables.
   [INFO ] 19:42:07.408 [main] o.a.s.i.c.s.SchemaContextsBuilder - Load meta data for schema replica_query_db finished, cost 97 milliseconds.
   Thanks for using Atomikos! Evaluate http://www.atomikos.com/Main/ExtremeTransactions for advanced features and professional support
   or register at http://www.atomikos.com/Main/RegisterYourDownload to disable this message and receive FREE tips & advice
   [INFO ] 19:42:07.764 [main] o.a.s.p.i.i.AbstractBootstrapInitializer - Database name is `MySQL`, version is `5.7.32-log`
   [INFO ] 19:42:08.062 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success.
   [INFO ] 19:42:38.337 [ShardingSphere-Command-5] ShardingSphere-SQL - Logic SQL: show tables
   [INFO ] 19:42:38.337 [ShardingSphere-Command-5] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 19:42:38.337 [ShardingSphere-Command-5] ShardingSphere-SQL - Actual SQL: pr_ds ::: show tables
   [ERROR] 19:42:38.351 [ShardingSphere-Command-5] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	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)
   [INFO ] 19:42:43.098 [ShardingSphere-Command-6] ShardingSphere-SQL - Logic SQL: show tables
   [INFO ] 19:42:43.099 [ShardingSphere-Command-6] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 19:42:43.099 [ShardingSphere-Command-6] ShardingSphere-SQL - Actual SQL: pr_ds ::: show tables
   [ERROR] 19:42:43.100 [ShardingSphere-Command-6] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	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)
   ```


----------------------------------------------------------------
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] marktrue edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
marktrue edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-742409321


   same situation i have met.
   client: navicat or mariadb-client 10.3.25
   sharding-proxy: docker pulled from apache/sharding-proxy
   mariadb-server: MariaDB 10.3.25
   
   <pre>
   <code>
   [INFO ] 09:33:06.142 [ShardingSphere-Command-15] ShardingSphere-SQL - Logic SQL: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - Actual SQL: pr_ds ::: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [ERROR] 09:33:06.144 [ShardingSphere-Command-15] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   </pre>
   
   my config: conf/config-replica-query.yaml
   
   <pre>
   <code>
   
   schemaName: test
   #
   dataSourceCommon:
     username: *****
     password: *****
     connectionTimeoutMilliseconds: 30000
     idleTimeoutMilliseconds: 60000
     maxLifetimeMilliseconds: 1800000
     maxPoolSize: 50
     minPoolSize: 1
     maintenanceIntervalMilliseconds: 30000
   #
   dataSources:
     primary_ds:
       url: jdbc:mysql://192.168.1.131:3306/test?serverTimezone=UTC&useSSL=false
     replica_ds_0:
       url: jdbc:mysql://192.168.1.132:3306/test?serverTimezone=UTC&useSSL=false
     replica_ds_1:
       url: jdbc:mysql://192.168.1.133:3306/test?serverTimezone=UTC&useSSL=false
   #
   rules:
   - !REPLICA_QUERY
     dataSources:
       pr_ds:
         name: pr_ds
         primaryDataSourceName: primary_ds
         replicaDataSourceNames:
           - replica_ds_0
           - replica_ds_1
         loadBalancerName: robin
     loadBalancers:
       robin:
         type: ROUND_ROBIN
         props:
   
   </code>
   </pre>


----------------------------------------------------------------
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 edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-744163031


   Hi @zhangwei1989,
   
   Thanks to your assistance, I located the cause of this issue. Very appreciated!
   
   The reason is that there is incorrect handling for `AllSQLRouteExecutor`, i.e., `MySQLShowTablesStatement`. : (
   
   @terrymanu  will fix this bug ASAP. Please be patient.
   
   BTW, once this issue is closed, it is possible to pull the master branch and install it to get the ShardingProxy tar file for your following test If you want.
   
   Best wishes,
   
   Trista
   


----------------------------------------------------------------
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] marktrue edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
marktrue edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-742421804


   it seems happened only when query show tables;
   <pre>
   <code>
   [INFO ] 10:04:56.804 [ShardingSphere-Command-7] ShardingSphere-SQL - Logic SQL: select * from gk_user
   [INFO ] 10:04:56.804 [ShardingSphere-Command-7] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, lock=Optional.empty)
   [INFO ] 10:04:56.804 [ShardingSphere-Command-7] ShardingSphere-SQL - Actual SQL: replica_ds_0 ::: select * from gk_user
   [INFO ] 10:05:35.266 [ShardingSphere-Command-8] ShardingSphere-SQL - Logic SQL: show tables
   [INFO ] 10:05:35.267 [ShardingSphere-Command-8] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 10:05:35.267 [ShardingSphere-Command-8] ShardingSphere-SQL - Actual SQL: pr_ds ::: show tables
   [ERROR] 10:05:35.268 [ShardingSphere-Command-8] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   </pre>
   
   append another log
   
   <pre>
   <code>
   [INFO ] 10:13:13.789 [ShardingSphere-Command-12] ShardingSphere-SQL - Logic SQL: SELECT QUERY_ID, SUM(DURATION) AS SUM_DURATION FROM INFORMATION_SCHEMA.PROFILING GROUP BY QUERY_ID
   [INFO ] 10:13:13.789 [ShardingSphere-Command-12] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, lock=Optional.empty)
   [INFO ] 10:13:13.790 [ShardingSphere-Command-12] ShardingSphere-SQL - Actual SQL: replica_ds_1 ::: SELECT QUERY_ID, SUM(DURATION) AS SUM_DURATION FROM INFORMATION_SCHEMA.PROFILING GROUP BY QUERY_ID
   line 1:81 no viable alternative at input 'SELECTSTATEAS`状态`,ROUND(SUM(DURATION),7)AS`期间`,CONCAT(ROUND(SUM(DURATION)/*'
   line 1:81 no viable alternative at input 'SELECTSTATEAS`状态`,ROUND(SUM(DURATION),7)AS`期间`,CONCAT(ROUND(SUM(DURATION)/*'
   [ERROR] 10:13:13.815 [ShardingSphere-Command-13] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   org.antlr.v4.runtime.misc.ParseCancellationException: null
   	at org.antlr.v4.runtime.BailErrorStrategy.recover(BailErrorStrategy.java:51)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.select(MySQLStatementParser.java:3631)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.execute(MySQLStatementParser.java:936)
   	at org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser.parse(MySQLParser.java:37)
   	at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.twoPhaseParse(SQLParserExecutor.java:84)
   	at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.parse(SQLParserExecutor.java:59)
   	at org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor.parse(SQLParserExecutor.java:53)
   	at org.apache.shardingsphere.sql.parser.api.SQLParserEngine.parse(SQLParserEngine.java:46)
   	at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:65)
   	at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:53)
   	at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse0(ShardingSphereSQLParserEngine.java:74)
   	at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:60)
   	at org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandlerFactory.newInstance(TextProtocolBackendHandlerFactory.java:63)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:54)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:70)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:60)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:99)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   Caused by: org.antlr.v4.runtime.NoViableAltException: null
   	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026)
   	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
   	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
   	at org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.select(MySQLStatementParser.java:3594)
   	... 19 common frames omitted
   
   </code>
   </pre>
   
   


----------------------------------------------------------------
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] marktrue edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
marktrue edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-742409321


   same situation i have met.
   client: navicat or mariadb-client 10.3.25
   sharding-proxy: docker pulled from apache/sharding-proxy
   mariadb-server: MariaDB 10.3.25
   
   <pre>
   <code>
   [INFO ] 09:33:06.142 [ShardingSphere-Command-15] ShardingSphere-SQL - Logic SQL: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - Actual SQL: pr_ds ::: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [ERROR] 09:33:06.144 [ShardingSphere-Command-15] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   </pre>
   


----------------------------------------------------------------
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 #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @zhangwei1989,
   
   Thanks to your assistance, I located the cause of this issue. Very appreciated!
   
   The reason is that there is incorrect handling for `AllSQLRouteExecutor`, i.e., `MySQLShowTablesStatement`. : (
   
   @terrymanu  will fix this bug ASAP. Please be patient.
   
   Best wishes,
   
   Trista
   


----------------------------------------------------------------
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] zhangwei1989 edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
zhangwei1989 edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-743724602


   Hi @tristaZero,
   
   It's the debug log:
   
   - It entered into AllSQLRouteExecutor instead of PartialSQLRouteExecutor.
   ![HTTPClient结果](http://zhangwei1989.oss-cn-beijing.aliyuncs.com/2020-12-12-WechatIMG1110.jpeg)
   - It never entered into ReplicaQuerySQLRouter, so I can't find out why return pr_ds.
   
   What can I do to debug next?
   
   Thanks a lot~
   
   
    


----------------------------------------------------------------
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 #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @zhangwei1989 ,
   
   Update here. Could you set `sql-show = true` in server.ymal and give more log detail here? For instance,
   ```
   [INFO ] 15:59:03.621 [main] ShardingSphere-metadata - Loading 4 tables' meta data for unconfigured tables.
   [INFO ] 15:59:03.637 [main] ShardingSphere-metadata - Loading 4 tables' meta data for unconfigured tables.
   [INFO ] 15:59:03.645 [main] ShardingSphere-metadata - Loading 4 tables' meta data for unconfigured tables.
   [INFO ] 15:59:03.647 [main] o.a.s.i.c.m.MetaDataContextsBuilder - Load meta data for schema replica_query_db finished, cost 68 milliseconds.
   Thanks for using Atomikos! Evaluate http://www.atomikos.com/Main/ExtremeTransactions for advanced features and professional support
   or register at http://www.atomikos.com/Main/RegisterYourDownload to disable this message and receive FREE tips & advice
   [INFO ] 15:59:03.947 [main] o.a.s.p.i.i.AbstractBootstrapInitializer - Database name is `MySQL`, version is `8.0.20`
   [INFO ] 15:59:04.099 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success.
   [INFO ] 15:59:30.366 [ShardingSphere-Command-7] ShardingSphere-SQL - Logic SQL: SHOW COLUMNS FROM t_order_item_0 FROM replica_query_db
   [INFO ] 15:59:30.366 [ShardingSphere-Command-7] ShardingSphere-SQL - SQLStatement: MySQLShowColumnsStatement(table=SimpleTableSegment(tableName=TableNameSegment(startIndex=18, stopIndex=31, identifier=IdentifierValue(value=t_order_item_0, quoteCharacter=NONE)), owner=Optional.empty, alias=Optional.empty), fromSchema=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dal.FromSchemaSegment@24561780])
   [INFO ] 15:59:30.366 [ShardingSphere-Command-7] ShardingSphere-SQL - Actual SQL: primary_ds ::: SHOW COLUMNS FROM t_order_item_0 
   [INFO ] 15:59:30.
   ``` 
   
   


----------------------------------------------------------------
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 #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @zhangwei1989 
   
   Thanks for your feedback, I tried it on MacOS without docker, and it worked well. Could you give it a test on your macOS platform instead of docker? Thanks.


----------------------------------------------------------------
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] marktrue edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
marktrue edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-742409321


   same situation i have met.
   client: navicat or mariadb-client 10.3.25
   sharding-proxy: docker pulled from apache/sharding-proxy
   mariadb-server: MariaDB 10.3.25
   
   <pre>
   <code>
   [INFO ] 09:33:06.142 [ShardingSphere-Command-15] ShardingSphere-SQL - Logic SQL: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - Actual SQL: pr_ds ::: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [ERROR] 09:33:06.144 [ShardingSphere-Command-15] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   </pre>
   schemaName: test
   #
   dataSourceCommon:
     username: *****
     password: *****
     connectionTimeoutMilliseconds: 30000
     idleTimeoutMilliseconds: 60000
     maxLifetimeMilliseconds: 1800000
     maxPoolSize: 50
     minPoolSize: 1
     maintenanceIntervalMilliseconds: 30000
   #
   dataSources:
     primary_ds:
       url: jdbc:mysql://192.168.1.131:3306/test?serverTimezone=UTC&useSSL=false
     replica_ds_0:
       url: jdbc:mysql://192.168.1.132:3306/test?serverTimezone=UTC&useSSL=false
     replica_ds_1:
       url: jdbc:mysql://192.168.1.133:3306/test?serverTimezone=UTC&useSSL=false
   #
   rules:
   - !REPLICA_QUERY
     dataSources:
       pr_ds:
         name: pr_ds
         primaryDataSourceName: primary_ds
         replicaDataSourceNames:
           - replica_ds_0
           - replica_ds_1
         loadBalancerName: robin
     loadBalancers:
       robin:
         type: ROUND_ROBIN
         props:
   
   <pre>
   <code>
   
   </code>
   </pre>


----------------------------------------------------------------
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] zhangwei1989 commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @tristaZero ,
   
   I tried it on MacOS without docker, the result is the same.
   I'll try other Mysql version and be aware of updates of this issue.
   
   Thanks for your reply.
   


----------------------------------------------------------------
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 closed issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525


   


----------------------------------------------------------------
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] alonehat commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   - !REPLICA_QUERY
                 dataSources:
                   primary_ds: # the name must be the same as primaryDataSourceName
                     primaryDataSourceName: primary_ds


-- 
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 #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @zhangwei1989 ,
   
   Sorry to forget giving some of the necessary instruction. It is a good start to pull the repo. Next,
   1.  Uncomment the configuration in `shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf` as you did in the ShardingProxy tar file.
   2. Debug `Bootstrap.main()` in `shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy`
   
   If there is any question, please ping me here. : )
   


----------------------------------------------------------------
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] marktrue edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
marktrue edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-742409321


   same situation i have met.
   client: navicat or mariadb-client 10.3.25
   sharding-proxy: docker pulled from apache/sharding-proxy
   mariadb-server: MariaDB 10.3.25
   
   <pre>
   <code>
   [INFO ] 09:33:06.142 [ShardingSphere-Command-15] ShardingSphere-SQL - Logic SQL: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - Actual SQL: pr_ds ::: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [ERROR] 09:33:06.144 [ShardingSphere-Command-15] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   </pre>
   
   <pre>
   <code>
   
   schemaName: test
   #
   dataSourceCommon:
     username: *****
     password: *****
     connectionTimeoutMilliseconds: 30000
     idleTimeoutMilliseconds: 60000
     maxLifetimeMilliseconds: 1800000
     maxPoolSize: 50
     minPoolSize: 1
     maintenanceIntervalMilliseconds: 30000
   #
   dataSources:
     primary_ds:
       url: jdbc:mysql://192.168.1.131:3306/test?serverTimezone=UTC&useSSL=false
     replica_ds_0:
       url: jdbc:mysql://192.168.1.132:3306/test?serverTimezone=UTC&useSSL=false
     replica_ds_1:
       url: jdbc:mysql://192.168.1.133:3306/test?serverTimezone=UTC&useSSL=false
   #
   rules:
   - !REPLICA_QUERY
     dataSources:
       pr_ds:
         name: pr_ds
         primaryDataSourceName: primary_ds
         replicaDataSourceNames:
           - replica_ds_0
           - replica_ds_1
         loadBalancerName: robin
     loadBalancers:
       robin:
         type: ROUND_ROBIN
         props:
   
   </code>
   </pre>


----------------------------------------------------------------
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 edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-740422302


   Hi @zhangwei1989 
   
   Thanks for your feedback, I tried it on MacOS without docker, and it worked well. Could you give it a test on your macOS platform instead of docker? Oh, The version of MySQL on my computer is 8.0. Thanks.


----------------------------------------------------------------
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] marktrue edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
marktrue edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-742409321


   same situation i have met.
   client: navicat or mariadb-client 10.3.25
   sharding-proxy: docker pulled from apache/sharding-proxy
   mariadb-server: MariaDB 10.3.25
   
   <code>
   [INFO ] 09:33:06.142 [ShardingSphere-Command-15] ShardingSphere-SQL - Logic SQL: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - Actual SQL: pr_ds ::: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [ERROR] 09:33:06.144 [ShardingSphere-Command-15] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   
   


----------------------------------------------------------------
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 #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @zhangwei1989 ,
   
   Thanks for your response. : )
   
   From the log, we can see the cause is the wrong routing result due to different MySQL client versions.
   ```
    Actual SQL: primary_ds ::: SHOW COLUMNS FROM t_order_item_0 
   
   VS
   
   Actual SQL: pr_ds ::: show tables
   ```
   
   See here, your SQL `show tables` got a `logic masterSlave name`, i.e., `pr_ds` rather than the correct one `primary_ds` or `replica_ds_x`.
   
   Could you give me a hand to locate the cause?
   - Please set a breakpoint at [PartialSQLRouteExecutor](https://github.com/apache/shardingsphere/blob/5dc690c2227571e83beada277dbb2dfb43c29427/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/impl/PartialSQLRouteExecutor.java#L59)
   - Check the `sqlStatementContext` of `LogicSQL` is  the instance of `CommonSQLStatementContext`. Also, `CommonSQLStatementContext ` contains `MySQLShowTablesStatement`
   - Check whether your program enters into `ReplicaQuerySQLRouter` or not
   - If so, please figure out why `ReplicaQuerySQLRouter` return `pr_ds`
   
   Looking forward to your feedback, thanks.


----------------------------------------------------------------
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] marktrue commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   it seems happened only when query show tables;
   <pre>
   <code>
   [INFO ] 10:04:56.804 [ShardingSphere-Command-7] ShardingSphere-SQL - Logic SQL: select * from gk_user
   [INFO ] 10:04:56.804 [ShardingSphere-Command-7] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, lock=Optional.empty)
   [INFO ] 10:04:56.804 [ShardingSphere-Command-7] ShardingSphere-SQL - Actual SQL: replica_ds_0 ::: select * from gk_user
   [INFO ] 10:05:35.266 [ShardingSphere-Command-8] ShardingSphere-SQL - Logic SQL: show tables
   [INFO ] 10:05:35.267 [ShardingSphere-Command-8] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 10:05:35.267 [ShardingSphere-Command-8] ShardingSphere-SQL - Actual SQL: pr_ds ::: show tables
   [ERROR] 10:05:35.268 [ShardingSphere-Command-8] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   
   </code>
   </pre>


----------------------------------------------------------------
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] marktrue commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   same situation i have met.
   client: navicat or mariadb-client 10.3.25
   sharding-proxy: docker pulled from apache/sharding-proxy
   mariadb-server: MariaDB 10.3.25
   
   `[INFO ] 09:33:06.142 [ShardingSphere-Command-15] ShardingSphere-SQL - Logic SQL: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - SQLStatement: MySQLShowTablesStatement(fromSchema=Optional.empty)
   [INFO ] 09:33:06.143 [ShardingSphere-Command-15] ShardingSphere-SQL - Actual SQL: pr_ds ::: SHOW FULL TABLES WHERE Table_type != 'VIEW'
   [ERROR] 09:33:06.144 [ShardingSphere-Command-15] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Can not get connection from datasource pr_ds.
   	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:987)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:80)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.getConnections(JDBCBackendDataSource.java:62)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnectionsWithoutTransaction(BackendConnection.java:141)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection.getConnections(BackendConnection.java:102)
   	at org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine.generateSQLExecuteGroups(ResourceManagedExecuteGroupEngine.java:66)
   	at org.apache.shardingsphere.infra.executor.sql.group.AbstractExecuteGroupEngine.generate(AbstractExecuteGroupEngine.java:58)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.generateInputGroups(JDBCExecuteEngine.java:140)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.executeWithManagedResource(JDBCExecuteEngine.java:130)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:123)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.execute.engine.jdbc.JDBCExecuteEngine.execute(JDBCExecuteEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.doExecute(JDBCDatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:79)
   	at org.apache.shardingsphere.proxy.backend.text.admin.ShowTablesBackendHandler.execute(ShowTablesBackendHandler.java:65)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   `
   
   


----------------------------------------------------------------
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] zhangwei1989 commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @tristaZero,
   
   All I have done was on 5.0.0-alpha branch. I tried on master branch today, it worked fine.
   
   Thank you very much for confirming.


----------------------------------------------------------------
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 edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-741603244


   Hi @zhangwei1989 ,
   
   Update here. Could you set `sql-show = true` in server.yall and show more log here? For instance,
   ```
   [INFO ] 15:59:03.621 [main] ShardingSphere-metadata - Loading 4 tables' meta data for unconfigured tables.
   [INFO ] 15:59:03.637 [main] ShardingSphere-metadata - Loading 4 tables' meta data for unconfigured tables.
   [INFO ] 15:59:03.645 [main] ShardingSphere-metadata - Loading 4 tables' meta data for unconfigured tables.
   [INFO ] 15:59:03.647 [main] o.a.s.i.c.m.MetaDataContextsBuilder - Load meta data for schema replica_query_db finished, cost 68 milliseconds.
   Thanks for using Atomikos! Evaluate http://www.atomikos.com/Main/ExtremeTransactions for advanced features and professional support
   or register at http://www.atomikos.com/Main/RegisterYourDownload to disable this message and receive FREE tips & advice
   [INFO ] 15:59:03.947 [main] o.a.s.p.i.i.AbstractBootstrapInitializer - Database name is `MySQL`, version is `8.0.20`
   [INFO ] 15:59:04.099 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success.
   [INFO ] 15:59:30.366 [ShardingSphere-Command-7] ShardingSphere-SQL - Logic SQL: SHOW COLUMNS FROM t_order_item_0 FROM replica_query_db
   [INFO ] 15:59:30.366 [ShardingSphere-Command-7] ShardingSphere-SQL - SQLStatement: MySQLShowColumnsStatement(table=SimpleTableSegment(tableName=TableNameSegment(startIndex=18, stopIndex=31, identifier=IdentifierValue(value=t_order_item_0, quoteCharacter=NONE)), owner=Optional.empty, alias=Optional.empty), fromSchema=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dal.FromSchemaSegment@24561780])
   [INFO ] 15:59:30.366 [ShardingSphere-Command-7] ShardingSphere-SQL - Actual SQL: primary_ds ::: SHOW COLUMNS FROM t_order_item_0 
   [INFO ] 15:59:30.
   ``` 
   
   


----------------------------------------------------------------
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 #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @zhangwei1989  ,
   
   We gave a test on your issue. It looks some of the MySQL clients can avoid this exception. But definitely, it is a bug of ShardingProxy. We will fix it ASAP. Please watch this issue for any updates.
   Thanks.


----------------------------------------------------------------
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 edited a comment on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #8525:
URL: https://github.com/apache/shardingsphere/issues/8525#issuecomment-744163031


   Hi @zhangwei1989,
   
   Thanks to your assistance, I located the cause of this issue. Very appreciated!
   
   The reason is that there is incorrect handling for `AllSQLRouteExecutor`, i.e., `MySQLShowTablesStatement`. : (
   
   However, I looked at the master branch, and it seems this bug has been fixed. Your debug work was on master branch? Or 5.0.0-alpha?
   
   Best wishes,
   
   Trista
   


----------------------------------------------------------------
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] zhangwei1989 commented on issue #8525: NullPointerException: Can not get connection from datasource pr_ds

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


   Hi @tristaZero,
   
   My situation is the same with @marktrue. It happened only when query `show tables;`.
   
   I really want to help figuring out the reason why it happened, but I don't know how to set a breakpoint to the file in apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy-bin in IntelliJ IDEA. Cause the proxy is started with start.sh in apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy-bin/bin.
   
   If I need to start the proxy from the source code in IDE, what can I do to start the proxy? And what can I do to config the proxy?
   
   I pulled the latest source code of shardingsphere-proxy, but I can't find the place to config the program and the way to start the proxy.
   
   I searched Google, but I still can't find any useful information. Can you give me some tips?
   
   Thanks a lot~


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