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/10/10 06:37:41 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue, #19545: NullPointerException occurred when using ShardingSphere-Proxy MySQL Protocol + PostgreSQL Storage

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   master - 5976d9eaa392875fb034c7207717145c5d483bfc
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Query worked.
   
   ```sql
   select * from bmsql_item limit 10
   ```
   
   ```sql
   show tables
   ```
   
   ### Actual behavior
   
   #### select *
   ```
   [ERROR] 2022-07-26 11:19:11.346 [ShardingSphere-Command-0] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Cannot invoke "org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema.getAllColumnNames(String)" because the return value of "java.util.Map.get(Object)" is null
   	at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionEngine.getShorthandColumnsFromSimpleTableSegment(ProjectionEngine.java:163)
   	at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionEngine.createProjection(ProjectionEngine.java:117)
   	at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionEngine.createProjection(ProjectionEngine.java:82)
   	at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionsContextEngine.getProjections(ProjectionsContextEngine.java:77)
   	at org.apache.shardingsphere.infra.binder.segment.select.projection.engine.ProjectionsContextEngine.createProjectionsContext(ProjectionsContextEngine.java:67)
   	at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:116)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:160)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:143)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:128)
   	at org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandlerFactory.newInstance(TextProtocolBackendHandlerFactory.java:117)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.<init>(MySQLComQueryPacketExecutor.java:72)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecutorFactory.newInstance(MySQLCommandExecutorFactory.java:77)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine.getCommandExecutor(MySQLCommandExecuteEngine.java:61)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:110)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   	at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   
   ![image](https://user-images.githubusercontent.com/20503072/180916424-a647c49e-44b9-4ae5-b7f4-fc602a7ec008.png)
   
   Query without wildcard worked.
   ![image](https://user-images.githubusercontent.com/20503072/180917114-99be0cc1-b376-471c-b717-63f54a14e196.png)
   
   #### show tables
   
   ```
   [ERROR] 2022-07-26 11:34:33.088 [ShardingSphere-Command-1] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.NullPointerException: Cannot invoke "org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema.getTables()" because the return value of "org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.getSchema(String)" is null
   	at org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.ShowTablesExecutor.getAllTableNames(ShowTablesExecutor.java:95)
   	at org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.ShowTablesExecutor.getQueryResult(ShowTablesExecutor.java:84)
   	at org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.ShowTablesExecutor.execute(ShowTablesExecutor.java:69)
   	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:94)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:112)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
   	at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   
   ![image](https://user-images.githubusercontent.com/20503072/180917396-45f9b601-469b-4385-9a5a-c747b0119b21.png)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   server.yaml
   ```yaml
   props:
     proxy-frontend-database-protocol-type: MySQL
   ```
   
   config-sharding.yaml
   ```yaml
   schemaName: bmsql_sharding
   dataSources:
     ds_0:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_0
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_1:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_1
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_2:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_2
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_3:
       url: jdbc:postgresql://127.0.0.1:5432/bmsql_3
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
   
   rules:
     - !SHARDING
       defaultDatabaseStrategy:
         none:
       defaultTableStrategy:
         none:
       keyGenerators:
       tables:
         bmsql_item:
           actualDataNodes: ds_${0..3}.bmsql_item
           databaseStrategy:
             standard:
               shardingColumn: i_id
               shardingAlgorithmName: mod_4
       shardingAlgorithms:
         mod_4:
           type: MOD
           props:
             sharding-count: 4
   ```
   
   ```sql
   create table bmsql_item (
     i_id     integer      not null,
     i_name   varchar(24),
     i_price  decimal(5,2),
     i_data   varchar(50),
     i_im_id  integer
   );
   ```
   


-- 
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] github-actions[bot] closed issue #19545: NullPointerException occurred when using ShardingSphere-Proxy MySQL Protocol + PostgreSQL Storage

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #19545: NullPointerException occurred when using ShardingSphere-Proxy MySQL Protocol + PostgreSQL Storage 
URL: https://github.com/apache/shardingsphere/issues/19545


-- 
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] github-actions[bot] commented on issue #19545: NullPointerException occurred when using ShardingSphere-Proxy MySQL Protocol + PostgreSQL Storage

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19545:
URL: https://github.com/apache/shardingsphere/issues/19545#issuecomment-1272349220

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


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