You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "YeonCheolGit (via GitHub)" <gi...@apache.org> on 2024/03/23 19:42:58 UTC

[PR] refactor: clarify if condition [incubator-seata]

YeonCheolGit opened a new pull request, #6442:
URL: https://github.com/apache/incubator-seata/pull/6442

   <!-- Please make sure you have read and understood the contributing guidelines -->
   
   - [ ] I have registered the PR [changes](../changes).
   
   ### Ⅰ. Describe what this PR did
   - Changed to clarify the If condition that does various things
   - Change the English grammar of comments to be more natural
   
   ### Ⅱ. Does this pull request fix one issue?
   <!-- If that, add "fixes #xxx" below in the next line, for example, fixes #97. -->
   
   
   ### Ⅲ. Why don't you add test cases (unit test/integration test)? 
   It has already tese cases.
   
   
   ### Ⅳ. Describe how to verify it
   
   
   ### Ⅴ. Special notes for reviews
   
   


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "slievrly (via GitHub)" <gi...@apache.org>.
slievrly commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1536844601


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Sorry, I don't understand the purpose of doing this. Here, conn.getAutoCommit() is used twice.
   
   



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2040535199

   > @YeonCheolGit Hi,Please register your PR in those two files : https://github.com/apache/incubator-seata/blob/2.x/changes/zh-cn/2.x.md https://github.com/apache/incubator-seata/blob/2.x/changes/en-us/2.x.md
   
   Thank you for letting me know. I added my PR in thoes two files.
   - https://github.com/apache/incubator-seata/pull/6464
   - https://github.com/apache/incubator-seata/pull/6463


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2016746327

   cc. @funky-eyes 


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "xingfudeshi (via GitHub)" <gi...@apache.org>.
xingfudeshi commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2040747765

   You should update the changes file in this PR without creating a separate PR.


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "xingfudeshi (via GitHub)" <gi...@apache.org>.
xingfudeshi commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2029073806

   @YeonCheolGit Hi,Please register your PR in those two files :
   https://github.com/apache/incubator-seata/blob/2.x/changes/zh-cn/2.x.md 
   https://github.com/apache/incubator-seata/blob/2.x/changes/en-us/2.x.md


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1536846853


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Thank you for the review. 
   
   I intended to divdie assign to variable and check whether is true or not in If condtion for clarify. `conn.getAutoCommit()` returns only state so i assumed will be okay for using twice.
   
   What about these alternatively?
   ```
   originalAutoCommit = conn.getAutoCommit();
   if (originalAutoCommit)
   ```
   or
   ```
   final boolean autoCommitState = conn.getAutoCommit();
   originalAutoCommit = autoCommitState
   if (autoCommitState)
   ```



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1545464344


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Thanks for your review! 
   I've addressed your comments and pushed a new commit with the 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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "1150456356 (via GitHub)" <gi...@apache.org>.
1150456356 commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2016740116

   good


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "1150456356 (via GitHub)" <gi...@apache.org>.
1150456356 commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2016740095

   good


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1536846853


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   @slievrly Thank you for the review. 
   
   I intended to divdie assign to variable and check whether is true or not in If condtion for clarify. `conn.getAutoCommit()` returns only state so i assumed will be okay for using twice.
   
   What about these alternatively?
   ```
   originalAutoCommit = conn.getAutoCommit();
   if (originalAutoCommit)
   ```
   or
   ```
   final boolean autoCommitState = conn.getAutoCommit();
   originalAutoCommit = autoCommitState
   if (autoCommitState)
   ```



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2028319753

   > Additionally, remember to update the change log. This PR falls under the category of optimization.
   
   I changed commit message from 'refactor' to 'optimize'. Thanks for the review :)


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "xingfudeshi (via GitHub)" <gi...@apache.org>.
xingfudeshi merged PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2041509295

   > You should update the changes file in this PR without creating a separate PR.
   
   Oh i misunderstanded. Add commit in this PR.


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1536846853


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Thank you for the review. 
   
   I intended to divdie assign to variable and check whether is true or not in If condtion for clarify. And I thought `conn.getAutoCommit()` returns only state then will be okay for using twice.
   
   What about this alternatively?
   ```
   originalAutoCommit = conn.getAutoCommit();
   if (originalAutoCommit)
   ```
   or
   ```
   final boolean autoCommitState = conn.getAutoCommit();
   originalAutoCommit = autoCommitState
   if (autoCommitState)
   ```



##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Thank you for the review. 
   
   I intended to divdie assign to variable and check whether is true or not in If condtion for clarify. And I assumed `conn.getAutoCommit()` returns only state then will be okay for using twice.
   
   What about this alternatively?
   ```
   originalAutoCommit = conn.getAutoCommit();
   if (originalAutoCommit)
   ```
   or
   ```
   final boolean autoCommitState = conn.getAutoCommit();
   originalAutoCommit = autoCommitState
   if (autoCommitState)
   ```



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "slievrly (via GitHub)" <gi...@apache.org>.
slievrly commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1558682664


##########
changes/zh-cn/2.x.md:
##########
@@ -115,6 +115,11 @@
 - [[#6387](https://github.com/apache/incubator-seata/pull/6387)] 优化tcc使用兼容
 - [[#6402](https://github.com/apache/incubator-seata/pull/6402)] 优化rm-datasource向下兼容
 - [[#6419](https://github.com/apache/incubator-seata/pull/6419)] 优化integration-tx-api向下兼容
+- [[#6442](https://github.com/apache/incubator-seata/pull/6442)] 阐明 if

Review Comment:
   The change log look there are some problems.



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2028327793

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `50.00000%` with `3 lines` in your changes are missing coverage. Please review.
   > Project coverage is 50.85%. Comparing base [(`f7fb1f8`)](https://app.codecov.io/gh/apache/incubator-seata/commit/f7fb1f8c746f53c3e70358f4563ce25dbbf8262e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`ec35f20`)](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 7 commits behind head on 2.x.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/incubator-seata/pull/6442/graphs/tree.svg?width=650&height=150&src=pr&token=tbmHt2ZfxO&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@             Coverage Diff              @@
   ##                2.x    #6442      +/-   ##
   ============================================
   + Coverage     50.41%   50.85%   +0.44%     
   - Complexity     5252     5286      +34     
   ============================================
     Files           941      942       +1     
     Lines         33279    33273       -6     
     Branches       4035     4030       -5     
   ============================================
   + Hits          16776    16922     +146     
   + Misses        14877    14685     -192     
   - Partials       1626     1666      +40     
   ```
   
   
   | [Files](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...ver/storage/redis/lock/RedisDistributedLocker.java](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvc3RvcmFnZS9yZWRpcy9sb2NrL1JlZGlzRGlzdHJpYnV0ZWRMb2NrZXIuamF2YQ==) | `59.09% <ø> (-13.64%)` | :arrow_down: |
   | [...ata/rm/datasource/undo/AbstractUndoLogManager.java](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cm0tZGF0YXNvdXJjZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VhdGEvcm0vZGF0YXNvdXJjZS91bmRvL0Fic3RyYWN0VW5kb0xvZ01hbmFnZXIuamF2YQ==) | `53.15% <50.00%> (+0.24%)` | :arrow_up: |
   | [...org/apache/seata/server/session/SessionHolder.java](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvc2Vzc2lvbi9TZXNzaW9uSG9sZGVyLmphdmE=) | `52.44% <50.00%> (-2.49%)` | :arrow_down: |
   | [...a/server/storage/db/lock/LockStoreDataBaseDAO.java](https://app.codecov.io/gh/apache/incubator-seata/pull/6442?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvc3RvcmFnZS9kYi9sb2NrL0xvY2tTdG9yZURhdGFCYXNlREFPLmphdmE=) | `50.48% <50.00%> (+0.24%)` | :arrow_up: |
   
   ... and [51 files with indirect coverage changes](https://app.codecov.io/gh/apache/incubator-seata/pull/6442/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   </details>


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "slievrly (via GitHub)" <gi...@apache.org>.
slievrly commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1537081743


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   I prefer the first expression for its simplicity and fidelity to the original meaning.



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: clarify if conditions [incubator-seata]

Posted by "slievrly (via GitHub)" <gi...@apache.org>.
slievrly commented on PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#issuecomment-2017272775

   Additionally, remember to update the change log. This PR falls under the category of optimization.


-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1536846853


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Thank you for the review. 
   
   I intended to divdie assign to variable and check whether is true or not in If condtion for clarify. `conn.getAutoCommit()` returns only state so i assumed will be okay for using twice.
   
   What about this alternatively?
   ```
   originalAutoCommit = conn.getAutoCommit();
   if (originalAutoCommit)
   ```
   or
   ```
   final boolean autoCommitState = conn.getAutoCommit();
   originalAutoCommit = autoCommitState
   if (autoCommitState)
   ```



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] refactor: clarify if conditions [incubator-seata]

Posted by "YeonCheolGit (via GitHub)" <gi...@apache.org>.
YeonCheolGit commented on code in PR #6442:
URL: https://github.com/apache/incubator-seata/pull/6442#discussion_r1536846853


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:
##########
@@ -264,9 +264,10 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
             try {
                 connectionProxy = dataSourceProxy.getConnection();
                 conn = connectionProxy.getTargetConnection();
+                originalAutoCommit = conn.getAutoCommit();
 
                 // The entire undo process should run in a local transaction.
-                if (originalAutoCommit = conn.getAutoCommit()) {
+                if (conn.getAutoCommit()) {

Review Comment:
   Thank you for the review. 
   
   I intended to divdie assign to variable and check whether is true or not in If condtion. `conn.getAutoCommit()` returns only state then will be okay for using twice.
   
   What about this alternatively?
   ```
   originalAutoCommit = conn.getAutoCommit();
   if (originalAutoCommit)
   ```
   or
   ```
   final boolean autoCommitState = conn.getAutoCommit();
   originalAutoCommit = autoCommitState
   if (autoCommitState)
   ```



-- 
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@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org