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/11/29 01:20:02 UTC
[GitHub] [shardingsphere] FlyingZC opened a new pull request, #22492: Fix postgresql set transaction isolation
FlyingZC opened a new pull request, #22492:
URL: https://github.com/apache/shardingsphere/pull/22492
Changes proposed in this pull request:
- Fix postgresql set transaction isolation
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have self-reviewed the commit code.
- [x] I have (or in comment I request) added corresponding labels for the pull request.
- [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [x] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
--
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 #22492: Fix postgresql set transaction isolation
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492#discussion_r1034250686
##########
sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLTCLStatementSQLVisitor.java:
##########
@@ -68,7 +71,40 @@ public PostgreSQLTCLStatementSQLVisitor(final Properties props) {
@Override
public ASTNode visitSetTransaction(final SetTransactionContext ctx) {
- return new PostgreSQLSetTransactionStatement();
+ PostgreSQLSetTransactionStatement result = new PostgreSQLSetTransactionStatement();
+ if (null != ctx.transactionModeList()) {
+ ctx.transactionModeList().transactionModeItem().forEach(each -> {
+ setTransactionAccessType(result, each);
+ setTransactionIsolationLevel(result, each);
+ });
+ }
+ return result;
+ }
+
+ private void setTransactionAccessType(final PostgreSQLSetTransactionStatement statement, final TransactionModeItemContext modeItemContext) {
+ TransactionAccessType accessType = null;
+ if (null != modeItemContext.ONLY()) {
+ accessType = TransactionAccessType.READ_ONLY;
+ } else if (null != modeItemContext.WRITE()) {
+ accessType = TransactionAccessType.READ_WRITE;
+ }
+ statement.setAccessMode(accessType);
+ }
+
+ private void setTransactionIsolationLevel(final PostgreSQLSetTransactionStatement statement, final TransactionModeItemContext modeItemContext) {
Review Comment:
OK.
--
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 merged pull request #22492: Fix postgresql set transaction isolation
Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492
--
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 pull request #22492: Fix postgresql set transaction isolation
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492#issuecomment-1333218894
<img width="943" alt="image" src="https://user-images.githubusercontent.com/19788130/204973729-8164f1ba-458e-491e-8df0-82dae7ffc133.png">
--
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 #22492: Fix postgresql set transaction isolation
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492#issuecomment-1329971838
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/22492?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 [#22492](https://codecov.io/gh/apache/shardingsphere/pull/22492?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9e0bf8e) into [master](https://codecov.io/gh/apache/shardingsphere/commit/07300fdd7856ac91548851cd739e8fc8dedfc153?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (07300fd) will **decrease** coverage by `0.02%`.
> The diff coverage is `0.00%`.
```diff
@@ Coverage Diff @@
## master #22492 +/- ##
============================================
- Coverage 50.99% 50.96% -0.03%
Complexity 2514 2514
============================================
Files 4185 4185
Lines 58232 58261 +29
Branches 9898 9906 +8
============================================
Hits 29695 29695
- Misses 26011 26040 +29
Partials 2526 2526
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/22492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...end/handler/transaction/TransactionSetHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/22492/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-cHJveHkvYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9oYW5kbGVyL3RyYW5zYWN0aW9uL1RyYW5zYWN0aW9uU2V0SGFuZGxlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...atement/impl/PostgreSQLTCLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/22492/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-c3FsLXBhcnNlci9kaWFsZWN0L3Bvc3RncmVzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvcG9zdGdyZXNxbC92aXNpdG9yL3N0YXRlbWVudC9pbXBsL1Bvc3RncmVTUUxUQ0xTdGF0ZW1lbnRTUUxWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
: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
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #22492: Fix postgresql set transaction isolation
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492#discussion_r1034246194
##########
sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLTCLStatementSQLVisitor.java:
##########
@@ -68,7 +71,40 @@ public PostgreSQLTCLStatementSQLVisitor(final Properties props) {
@Override
public ASTNode visitSetTransaction(final SetTransactionContext ctx) {
- return new PostgreSQLSetTransactionStatement();
+ PostgreSQLSetTransactionStatement result = new PostgreSQLSetTransactionStatement();
+ if (null != ctx.transactionModeList()) {
+ ctx.transactionModeList().transactionModeItem().forEach(each -> {
+ setTransactionAccessType(result, each);
+ setTransactionIsolationLevel(result, each);
+ });
+ }
+ return result;
+ }
+
+ private void setTransactionAccessType(final PostgreSQLSetTransactionStatement statement, final TransactionModeItemContext modeItemContext) {
+ TransactionAccessType accessType = null;
+ if (null != modeItemContext.ONLY()) {
+ accessType = TransactionAccessType.READ_ONLY;
+ } else if (null != modeItemContext.WRITE()) {
+ accessType = TransactionAccessType.READ_WRITE;
+ }
+ statement.setAccessMode(accessType);
+ }
+
+ private void setTransactionIsolationLevel(final PostgreSQLSetTransactionStatement statement, final TransactionModeItemContext modeItemContext) {
Review Comment:
Can we refactor this method to getTransactionIsolationLevel and then use guard clause?
--
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 pull request #22492: Fix postgresql set transaction isolation
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492#issuecomment-1329998317
>
OK,I have submitted the issue.
--
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