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

   ## 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?
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ### Expected behavior
   After executing the "create sharding binding table rules (t_ssdb_tb_view, 
t_ssdb_tb);" statement, the next SQL statement is executed normally
   
   ### Actual behavior
   After executing the "create sharding binding table rules (t_ssdb_tb_view, 
t_ssdb_tb);" statement, an error will be reported when the next SQL statement 
is executed
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   ```
   drop view if exists t_ssdb_tb_view;
   drop view if exists t_ssdb_tb_view_new;
   drop table if exists t_ssdb_tb;
   create table t_ssdb_tb(id int,c_id int,a int,b char(10));
   insert into t_ssdb_tb values 
(1,1,10,'test11'),(1,2,10,'Test12'),(1,2,null,'test12'),
   (2,1,20,'test21'),(2,2,20,'test22'),(2,3,null,'Test22'),
   (3,3,null,'test3'),(3,3,null,'test3'),(4,4,40,'test4'),(5,5,50,'Test5');
   show sharding binding table rules;
   create sharding binding table rules (t_ssdb_tb_view, t_ssdb_tb);
   select pg_sleep(2);
   ```
   
   ```
   drop view if exists t_ssdb_tb_view;
   DROP VIEW
   drop view if exists t_ssdb_tb_view_new;
   DROP VIEW
   drop table if exists t_ssdb_tb;
   DROP TABLE
   create table t_ssdb_tb(id int,c_id int,a int,b char(10));
   CREATE TABLE
   insert into t_ssdb_tb values 
(1,1,10,'test11'),(1,2,10,'Test12'),(1,2,null,'test12'),
   (2,1,20,'test21'),(2,2,20,'test22'),(2,3,null,'Test22'),
   (3,3,null,'test3'),(3,3,null,'test3'),(4,4,40,'test4'),(5,5,50,'Test5');
   INSERT 0 10
   
   show sharding binding table rules;
    sharding_binding_tables
   -------------------------
   (0 rows)
   
   create sharding binding table rules (t_ssdb_tb_view, t_ssdb_tb);
   SUCCESS
   select pg_sleep(2);
   ERROR:  java.lang.NullPointerException
   ```
   
   background log
   
   ```
   [INFO ] 2022-09-16 15:39:04.601 [Connection-3-ThreadExecutor] 
ShardingSphere-SQL - Logic SQL: select pg_sleep(2);
   [INFO ] 2022-09-16 15:39:04.601 [Connection-3-ThreadExecutor] 
ShardingSphere-SQL - SQLStatement: 
OpenGaussSelectStatement(super=SelectStatement(super=AbstractSQLStatement(parameterCount=0,
 parameterMarkerSegments=[], commentSegments=[]), 
projections=ProjectionsSegment(startIndex=7, stopIndex=17, 
projections=[ExpressionProjectionSegment(startIndex=7, stopIndex=17, 
text=pg_sleep(2), expr=FunctionSegment(startIndex=7, stopIndex=17, 
functionName=pg_sleep, parameters=[LiteralExpressionSegment(startIndex=16, 
stopIndex=16, literals=2)], text=pg_sleep(2), owner=null), 
alias=Optional.empty)], distinctRow=false), from=null, where=Optional.empty, 
groupBy=Optional.empty, having=Optional.empty, orderBy=Optional.empty, 
combines=[]), limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
   [INFO ] 2022-09-16 15:39:04.601 [Connection-3-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: ds1_1 ::: select pg_sleep(2);
   [ERROR] 2022-09-16 15:39:04.601 [Connection-3-ThreadExecutor] 
o.a.s.p.f.c.CommandExecutorTask - Exception occur:
   java.lang.NullPointerException: null
           at 
org.apache.shardingsphere.transaction.xa.XAShardingSphereTransactionManager.isInTransaction(XAShardingSphereTransactionManager.java:73)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.isInTransaction(JDBCBackendDataSource.java:118)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.JDBCBackendDataSource.createConnection(JDBCBackendDataSource.java:109)
           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:53)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection.createNewConnections(JDBCBackendConnection.java:96)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection.getConnections(JDBCBackendConnection.java:87)
           at 
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine.group(DriverExecutionPrepareEngine.java:88)
           at 
org.apache.shardingsphere.infra.executor.sql.prepare.AbstractExecutionPrepareEngine.prepare(AbstractExecutionPrepareEngine.java:62)
           at 
org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:187)
           at 
org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:153)
           at 
org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:147)
           at 
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:130)
           at 
org.apache.shardingsphere.proxy.backend.handler.data.impl.UnicastDatabaseBackendHandler.execute(UnicastDatabaseBackendHandler.java:76)
           at 
org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.execute(OpenGaussComQueryExecutor.java:77)
           at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
           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:750)
   ```
   
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

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

Reply via email to