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/07/06 09:16:38 UTC

[GitHub] [shardingsphere] mayfsac opened a new issue, #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   ## Question
   Why DriverJDBCExecutor#executor  do not handle the error result of branch thread execution?
    DriverJDBCExecutor#executor:
   
   ![image](https://user-images.githubusercontent.com/43204877/177512854-6437ce45-89f5-431a-9365-e899755c8555.png)
   JDBCExecutorCallback#execute:
   ![image](https://user-images.githubusercontent.com/43204877/177512621-edf3fba5-1801-4d0d-846a-eece36fbb9dc.png)
   
   In this way, the result of the overall sql execution is inconsistent with the expected result.
   
   eg:
   insert into xx_table (id,xxx,xxx) values (1,xx,xxx),(2,xxx,xxx);
   
   This statement will route to two datasources, ds0, ds1.
   
   If there is a row with primary key 1 in ds1, it will throw exception: Duplicate entry '1' for key 'PRIMARY';
   The final result is: the sql routed to ds0 is successfully executed, and the sql execution of ds1 fails.
   
   Why is it not processed as all failures, which leads to data inconsistency, and distributed transactions will not be rolled back
   
   
   


-- 
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] TeslaCN commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   There is still many work to be done to support heterogeneous data sources. This issue has been fixed by #19525. We will enhance the `getSaneResult` when we support heterogeneous data sources better.


-- 
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] mayfsac commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   > What is your version?
   sharding-jdbc 5.1.1
   This question does not involve distributed transactions, but just asks why sql is handled like this when it is executed
   


-- 
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] mayfsac commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   > moved to top in #9073.
   
   Is this bug a high priority?


-- 
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] TeslaCN commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   `return null` when `!isTruckThread` is because we didn't think about Exception cause by data. We will finish this issue before next release.


-- 
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] mayfsac commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   sharding-jdbc  5.1.1


-- 
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] TeslaCN closed issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #18897: Why DriverJDBCExecutor#executor  do not handle the error result of branch thread execution?
URL: https://github.com/apache/shardingsphere/issues/18897


-- 
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] TeslaCN commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   ## Description
   
   The root cause of this issue: **When handling exceptions, exceptions caused by data problems are not considered.**
   
   This logic is added in PR <https://github.com/apache/shardingsphere/pull/8760>, the original intention is to deal with the inconsistency of the front and back database types of ShardingSphere-Proxy.
   
   For example, ShardingSphere-Proxy uses the MySQL protocol to provide external services, and the database that Proxy actually connects to is the PostgreSQL database.
   
   Use MySQL Connector/J to connect to ShardingSphere-Proxy. During the connection establishment phase, some special SQL will be sent, such as querying MySQL-specific variables. If MySQL-specific SQL such as `show tables` is directly executed in PostgreSQL, an error will occur.
   
   The use of `getSaneResult` in the `catch (SQLException)` process is to handle the above situation.
   
   Why judge isTrunkThread and only getSaneResult in the main thread?
   At that time, only exceptions occurring in heterogeneous data sources were considered, and exceptions caused by data problems were not considered. The Actual SQL executed by ShardingSphere using multiple threads must originate from the same Logic SQL.
   
   For example, when `show tables` is executed to PostgreSQL, the results of multi-threaded concurrent execution must be consistent, so only the errors of the main thread are processed and saneResult is obtained.
   
   ## My Solution
   
   Checking Protocol Type in JDBCExecutorCallback:
   
   `getSaneResult` only if Protocol Type does not match Database Type.
   When the scenario does not involve heterogeneous data sources, the exception returned by the database is thrown directly.


-- 
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] TeslaCN commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   The null check was added in #8760.


-- 
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] terrymanu commented on issue #18897: Why DriverJDBCExecutor#executor do not handle the error result of branch thread execution?

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

   What is your version?


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