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/09/02 03:44:15 UTC
[GitHub] [shardingsphere] natehuangting opened a new pull request, #20726: When xa is enabled, batch operations automatically support transactions
natehuangting opened a new pull request, #20726:
URL: https://github.com/apache/shardingsphere/pull/20726
Fixes #20234 .
--
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] strongduanmu closed pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
strongduanmu closed pull request #20726: When xa is enabled, batch operations automatically support transactions
URL: https://github.com/apache/shardingsphere/pull/20726
--
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] strongduanmu commented on pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#issuecomment-1275443567
Hi @natehuangting, can you solve code conflict?
--
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] natehuangting commented on a diff in pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
natehuangting commented on code in PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#discussion_r962813654
##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -129,12 +135,33 @@ public ResponseHeader execute() throws SQLException {
return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
}
proxySQLExecutor.checkExecutePrerequisites(executionContext);
- List result = proxySQLExecutor.execute(executionContext);
- refreshMetaData(executionContext);
- Object executeResultSample = result.iterator().next();
- return executeResultSample instanceof QueryResult
- ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
- : processExecuteUpdate(executionContext, result);
+ TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+ SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+ JDBCBackendTransactionManager transactionManager = null;
+ if (TransactionType.XA == transactionStatus.getTransactionType() && transactionStatus.isInTransaction()
Review Comment:
> Can you exclude the scenario of routing to a single data node? At this time, using the local transaction can meet the requirements.
@strongduanmu Sorry, I forgot to add the condition, I have changed it.
--
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 a diff in pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
terrymanu commented on code in PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#discussion_r962324301
##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -129,12 +135,33 @@ public ResponseHeader execute() throws SQLException {
return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
}
proxySQLExecutor.checkExecutePrerequisites(executionContext);
- List result = proxySQLExecutor.execute(executionContext);
- refreshMetaData(executionContext);
- Object executeResultSample = result.iterator().next();
- return executeResultSample instanceof QueryResult
- ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
- : processExecuteUpdate(executionContext, result);
+ TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+ SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+ JDBCBackendTransactionManager transactionManager = null;
+ if (TransactionType.XA == transactionStatus.getTransactionType() && transactionStatus.isInTransaction()
+ && sqlStatement instanceof DMLStatement && !(sqlStatement instanceof SelectStatement)) {
+ proxySQLExecutor.getJdbcExecutor().getJdbcExecutor().setSerial(true);
+ transactionManager = new JDBCBackendTransactionManager(backendConnection);
+ transactionManager.begin();
+ }
+ ResponseHeader responseHeader;
+ try {
+ List result = proxySQLExecutor.execute(executionContext);
+ refreshMetaData(executionContext);
+ Object executeResultSample = result.iterator().next();
+ responseHeader = executeResultSample instanceof QueryResult
+ ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
+ : processExecuteUpdate(executionContext, result);
+ if (null != transactionManager) {
+ transactionManager.commit();
+ }
+ } catch (final SQLException ex) {
+ if (null != transactionManager) {
+ transactionManager.rollback();
+ }
+ throw ex;
+ }
+ return responseHeader;
Review Comment:
Return value should name as `result`
--
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] strongduanmu commented on a diff in pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#discussion_r962707354
##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -129,12 +135,33 @@ public ResponseHeader execute() throws SQLException {
return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
}
proxySQLExecutor.checkExecutePrerequisites(executionContext);
- List result = proxySQLExecutor.execute(executionContext);
- refreshMetaData(executionContext);
- Object executeResultSample = result.iterator().next();
- return executeResultSample instanceof QueryResult
- ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
- : processExecuteUpdate(executionContext, result);
+ TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+ SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+ JDBCBackendTransactionManager transactionManager = null;
+ if (TransactionType.XA == transactionStatus.getTransactionType() && transactionStatus.isInTransaction()
Review Comment:
Can you exclude the scenario of routing to a single data node? At this time, using the local transaction can meet the requirements.
--
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] strongduanmu commented on pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#issuecomment-1323259296
This pr has been supported by #22029
--
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] FlyingZC commented on a diff in pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#discussion_r990757221
##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -127,12 +133,33 @@ public ResponseHeader execute() throws SQLException {
return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
}
proxySQLExecutor.checkExecutePrerequisites(executionContext);
- List result = proxySQLExecutor.execute(executionContext);
- refreshMetaData(executionContext);
- Object executeResultSample = result.iterator().next();
- return executeResultSample instanceof QueryResult
- ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
- : processExecuteUpdate(executionContext, result);
+ TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+ SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+ JDBCBackendTransactionManager transactionManager = null;
+ if (TransactionType.XA == transactionStatus.getTransactionType() && transactionStatus.isInTransaction()
Review Comment:
Maybe not in the transaction `!transactionStatus.isInTransaction()` and then auto start the transaction.
--
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] codecov-commenter commented on pull request #20726: When xa is enabled, batch operations automatically support transactions
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#issuecomment-1235053088
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/20726?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#20726](https://codecov.io/gh/apache/shardingsphere/pull/20726?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (40ebb8b) into [master](https://codecov.io/gh/apache/shardingsphere/commit/b3f78f9db7ef685e7273e42c29a98b20fdb50dd6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b3f78f9) will **increase** coverage by `0.15%`.
> The diff coverage is `16.00%`.
```diff
@@ Coverage Diff @@
## master #20726 +/- ##
============================================
+ Coverage 61.06% 61.21% +0.15%
- Complexity 2416 2418 +2
============================================
Files 3971 3971
Lines 55176 55196 +20
Branches 9367 9370 +3
============================================
+ Hits 33691 33788 +97
+ Misses 18617 18530 -87
- Partials 2868 2878 +10
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/20726?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../proxy/backend/communication/ProxySQLExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL1Byb3h5U1FMRXhlY3V0b3IuamF2YQ==) | `31.25% <ø> (ø)` | |
| [...nication/jdbc/JDBCDatabaseCommunicationEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL2pkYmMvSkRCQ0RhdGFiYXNlQ29tbXVuaWNhdGlvbkVuZ2luZS5qYXZh) | `72.97% <0.00%> (-11.41%)` | :arrow_down: |
| [...communication/jdbc/executor/ProxyJDBCExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL2pkYmMvZXhlY3V0b3IvUHJveHlKREJDRXhlY3V0b3IuamF2YQ==) | `0.00% <ø> (ø)` | |
| [...r/sql/execute/engine/driver/jdbc/JDBCExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtZXhlY3V0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL2V4ZWN1dG9yL3NxbC9leGVjdXRlL2VuZ2luZS9kcml2ZXIvamRiYy9KREJDRXhlY3V0b3IuamF2YQ==) | `66.66% <100.00%> (+26.66%)` | :arrow_up: |
| [...handler/distsql/ral/hint/enums/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9oYW5kbGVyL2Rpc3RzcWwvcmFsL2hpbnQvZW51bXMvSGludFNvdXJjZVR5cGUuamF2YQ==) | `0.00% <0.00%> (-42.86%)` | :arrow_down: |
| [...e/jdbc/provider/JDBCRepositoryProviderFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5L3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LWpkYmMvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlLXJlcG9zaXRvcnktamRiYy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL3JlcG9zaXRvcnkvc3RhbmRhbG9uZS9qZGJjL3Byb3ZpZGVyL0pEQkNSZXBvc2l0b3J5UHJvdmlkZXJGYWN0b3J5LmphdmE=) | `66.66% <0.00%> (+66.66%)` | :arrow_up: |
| [...ode/repository/standalone/jdbc/JDBCRepository.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5L3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LWpkYmMvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlLXJlcG9zaXRvcnktamRiYy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL3JlcG9zaXRvcnkvc3RhbmRhbG9uZS9qZGJjL0pEQkNSZXBvc2l0b3J5LmphdmE=) | `90.62% <0.00%> (+90.62%)` | :arrow_up: |
| [...tandalone/jdbc/props/JDBCRepositoryProperties.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5L3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LWpkYmMvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlLXJlcG9zaXRvcnktamRiYy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL3JlcG9zaXRvcnkvc3RhbmRhbG9uZS9qZGJjL3Byb3BzL0pEQkNSZXBvc2l0b3J5UHJvcGVydGllcy5qYXZh) | `100.00% <0.00%> (+100.00%)` | :arrow_up: |
| [...andalone/jdbc/props/JDBCRepositoryPropertyKey.java](https://codecov.io/gh/apache/shardingsphere/pull/20726/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLXR5cGUvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5L3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLXN0YW5kYWxvbmUtbW9kZS1yZXBvc2l0b3J5LWpkYmMvc2hhcmRpbmdzcGhlcmUtc3RhbmRhbG9uZS1tb2RlLXJlcG9zaXRvcnktamRiYy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9tb2RlL3JlcG9zaXRvcnkvc3RhbmRhbG9uZS9qZGJjL3Byb3BzL0pEQkNSZXBvc2l0b3J5UHJvcGVydHlLZXkuamF2YQ==) | `100.00% <0.00%> (+100.00%)` | :arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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