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

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   we find java version: java8, full_version=1.8.0_282
   ShardingSphere-5.1.3-SNAPSHOT
   Commit ID: 7c67365b394d2e3ac562329b550c135c31ea764d
   Commit Message: Avoid overhead of invoking method in Optional.orElse (#18921)
   Branch: 7c67365b394d2e3ac562329b550c135c31ea764d
   Build time: 2022-07-08T19:24:17+0800
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   Configure multiple read-write splits,Operation is normal.
   ### Actual behavior
   Configure multiple read-write splits,Operation is abnormal.
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1.Configure multiple read-write splits
   2.start sharding-proxy
   3.sql  execute
   readwrite_splitting_db=> create table t_rw(id int,c_id int,a int,b text);
   ERROR:  java.lang.NullPointerException
   readwrite_splitting_db=> insert into t_rw values 
(1,1,10,'test1'),(1,2,10,'test1'),(2,2,20,'test2'),
   readwrite_splitting_db-> (3,3,10,'test3'),(4,4,40,'test4'),(5,5,50,'test5');
   ERROR:  java.lang.NullPointerException
   readwrite_splitting_db=> create index idx_rw on t_rw(id);
   ERROR:  java.lang.NullPointerException
   readwrite_splitting_db=> select * from t_rw;
   ERROR:  java.lang.NullPointerException
   
   **log information:**
   ```
   [INFO ] 2022-07-12 15:14:17.201 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Logic SQL: create table t_rw(id int,c_id int,a int,b text);
   [INFO ] 2022-07-12 15:14:17.201 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - SQLStatement: 
OpenGaussCreateTableStatement(ifNotExists=false)
   [INFO ] 2022-07-12 15:14:17.201 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: write_ds ::: create table t_rw(id int,c_id 
int,a int,b text);
   [INFO ] 2022-07-12 15:14:17.220 [HikariPool-8 connection adder] 
o.o.core.v3.ConnectionFactoryImpl - [41684e81-fbb0-4289-8704-6724091b2dbd] Try 
to connect. IP: 10.29.180.204:15000
   [INFO ] 2022-07-12 15:14:17.262 [HikariPool-8 connection adder] 
o.o.core.v3.ConnectionFactoryImpl - [7.212.123.28:33828/10.29.180.204:15000] 
Connection is established. ID: 41684e81-fbb0-4289-8704-6724091b2dbd
   [INFO ] 2022-07-12 15:14:17.268 [HikariPool-8 connection adder] 
o.o.core.v3.ConnectionFactoryImpl - Connect complete. ID: 
41684e81-fbb0-4289-8704-6724091b2dbd
   [ERROR] 2022-07-12 15:14:18.109 [Connection-1-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: null
           at 
org.apache.shardingsphere.infra.context.refresher.type.CreateTableStatementSchemaRefresher.refresh(CreateTableStatementSchemaRefresher.java:61)
           at 
org.apache.shardingsphere.infra.context.refresher.type.CreateTableStatementSchemaRefresher.refresh(CreateTableStatementSchemaRefresher.java:45)
           at 
org.apache.shardingsphere.infra.context.refresher.MetaDataRefreshEngine.refresh(MetaDataRefreshEngine.java:74)
           at 
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.refreshMetaData(DatabaseCommunicationEngine.java:105)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:139)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:71)
           at 
org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:63)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.execute(OpenGaussComQueryExecutor.java:76)
           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)
   [ERROR] 2022-07-12 15:14:18.144 [Connection-1-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: null
           at 
org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext.<init>(InsertStatementContext.java:95)
           at 
org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:169)
           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:103)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.<init>(OpenGaussComQueryExecutor.java:70)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecutorFactory.getCommandExecutor(OpenGaussCommandExecutorFactory.java:114)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecutorFactory.newInstance(OpenGaussCommandExecutorFactory.java:76)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecuteEngine.getCommandExecutor(OpenGaussCommandExecuteEngine.java:62)
           at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:106)
           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)
   [INFO ] 2022-07-12 15:14:18.151 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Logic SQL: create index idx_rw on t_rw(id);
   [INFO ] 2022-07-12 15:14:18.151 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - SQLStatement: 
OpenGaussCreateIndexStatement(generatedIndexStartIndex=Optional.empty)
   [INFO ] 2022-07-12 15:14:18.151 [Connection-1-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: write_ds ::: create index idx_rw on t_rw(id);
   [ERROR] 2022-07-12 15:14:18.164 [Connection-1-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: null
           at 
org.apache.shardingsphere.infra.context.refresher.type.CreateIndexStatementSchemaRefresher.refresh(CreateIndexStatementSchemaRefresher.java:53)
           at 
org.apache.shardingsphere.infra.context.refresher.type.CreateIndexStatementSchemaRefresher.refresh(CreateIndexStatementSchemaRefresher.java:40)
           at 
org.apache.shardingsphere.infra.context.refresher.MetaDataRefreshEngine.refresh(MetaDataRefreshEngine.java:74)
           at 
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.refreshMetaData(DatabaseCommunicationEngine.java:105)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:139)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:71)
           at 
org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:63)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.execute(OpenGaussComQueryExecutor.java:76)
           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)
   [ERROR] 2022-07-12 15:14:18.170 [Connection-1-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: 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:103)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.<init>(OpenGaussComQueryExecutor.java:70)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecutorFactory.getCommandExecutor(OpenGaussCommandExecutorFactory.java:114)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecutorFactory.newInstance(OpenGaussCommandExecutorFactory.java:76)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.OpenGaussCommandExecuteEngine.getCommandExecutor(OpenGaussCommandExecuteEngine.java:62)
           at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:106)
           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)
   ```
   
   
   ### Example codes for reproduce this issue (such as a github link).
   1、config-readwrite-splitting.yaml
   ```
   databaseName: readwrite_splitting_db
   dataSources:
     write_ds:
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 260
       minPoolSize: 1
       password: Huawei@123
       url: jdbc:opengauss://10.29.180.204:15000/test_split?batchMode=on
       username: tpccuser
     read_ds_0:
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 260
       minPoolSize: 1
       password: Huawei@123
       url: jdbc:opengauss://10.28.13.92:15000/test_split?batchMode=on
       username: tpccuser
     read_ds_1:
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 260
       minPoolSize: 1
       password: Huawei@123
       url: jdbc:opengauss://7.212.123.28:15000/test_split?batchMode=on
       username: tpccuser
   rules:
   - !READWRITE_SPLITTING
     dataSources:
       readwrite_ds:
         staticStrategy:
           writeDataSourceName: write_ds
           readDataSourceNames:
             - read_ds_0
             - read_ds_1
         loadBalancerName: random
     loadBalancers:
       random:
         type: FIXED_REPLICA_ROUND_ROBIN
   ```
   
   
   2、config-readwrite-splitting1.yaml 
   ```
   databaseName: readwrite_splitting_db1
   dataSources:
     write_ds:
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 260
       minPoolSize: 1
       password: Test@123
       url: jdbc:opengauss://IP1:15000/test_split1?batchMode=on
       username: tpccuser
     read_ds_0:
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 260
       minPoolSize: 1
       password: Test@123
       url: jdbc:opengauss://IP2:15000/test_split1?batchMode=on
       username: tpccuser
     read_ds_1:
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 260
       minPoolSize: 1
       password: Test@123
       url: jdbc:opengauss://IP3:15000/test_split1?batchMode=on
       username: tpccuser
   rules:
   - !READWRITE_SPLITTING
     dataSources:
       readwrite_ds:
         staticStrategy:
           writeDataSourceName: write_ds
           readDataSourceNames:
             - read_ds_0
             - read_ds_1
         loadBalancerName: random
     loadBalancers:
       random:
         type: FIXED_REPLICA_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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to