You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "somiljain2006 (via GitHub)" <gi...@apache.org> on 2026/05/30 21:10:34 UTC

[PR] Use explicit columns in rollback validation query [incubator-seata]

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

   - [x] I have read the [CONTRIBUTING.md](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md) guidelines.
   - [ ] I have registered the PR [changes](https://github.com/apache/incubator-seata/tree/2.x/changes).
   
   ### Ⅰ. Describe what this PR did
   
   Replace SELECT * in rollback validation queries with an explicit column list derived from table metadata to avoid column mismatches when Oracle tables contain invisible columns. This prevents false dirty-data detection and rollback failures during undo validation. 
   
   ### Ⅱ. Does this pull request fix one issue?
   
   Fixes #7099 
   
   ### Ⅲ. Why don't you add test cases (unit test/integration test)? 
   
   Added regression tests covering explicit column SQL generation and validation query construction.
   
   ### Ⅳ. Describe how to verify it
   
   Run the targeted unit tests: mvn -pl rm-datasource -Dtest=AbstractUndoExecutorTest test    
   
   ### Ⅴ. Special notes for reviews
   
   N/A


-- 
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] bugfix: use explicit columns in rollback validation query [incubator-seata]

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


-- 
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] Use explicit columns in rollback validation query [incubator-seata]

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


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoExecutor.java:
##########
@@ -306,10 +306,16 @@ protected TableRecords queryCurrentRecords(ConnectionProxy connectionProxy) thro
         int pkRowSize = pkRowValues.get(firstKey).size();
         List<SqlGenerateUtils.WhereSql> sqlConditions =
                 SqlGenerateUtils.buildWhereConditionListByPKs(pkNameList, pkRowSize, connectionProxy.getDbType());
+
+        List<Row> rows = undoRecords.getRows();
+        String selectColumns = undoRecords.getRows().get(0).getFields().stream()
+                .map(field -> ColumnUtils.addEscape(field.getName(), connectionProxy.getDbType()))
+                .collect(Collectors.joining(", "));
+
         TableRecords currentRecords = new TableRecords(tableMeta);
         int totalRowIndex = 0;
         for (SqlGenerateUtils.WhereSql sqlCondition : sqlConditions) {
-            String checkSQL = buildCheckSql(sqlUndoLog.getTableName(), sqlCondition.getSql());
+            String checkSQL = buildCheckSql(sqlUndoLog.getTableName(), sqlCondition.getSql(), selectColumns);

Review Comment:
   This new overload call bypasses the existing `BaseSqlServerUndoExecutor.buildCheckSql(String, String)` override, so SQL Server undo validation will now use the base `... FOR UPDATE` syntax instead of `WITH(UPDLOCK)`, which is invalid for SQL Server. Please preserve the dialect override path or add a SQL Server override for the new explicit-column overload.



-- 
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] Use explicit columns in rollback validation query [incubator-seata]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #8118:
URL: https://github.com/apache/incubator-seata/pull/8118#issuecomment-4584952469

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-seata/pull/8118?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 72.62%. Comparing base ([`b5538aa`](https://app.codecov.io/gh/apache/incubator-seata/commit/b5538aa5547071c485ada7b2c54f7f83ec706dd2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b047ee3`](https://app.codecov.io/gh/apache/incubator-seata/commit/b047ee390b43fce3db859417ca7c0b801bd04b7c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##                2.x    #8118      +/-   ##
   ============================================
   - Coverage     72.67%   72.62%   -0.05%     
     Complexity      883      883              
   ============================================
     Files          1327     1327              
     Lines         50714    50718       +4     
     Branches       6049     6049              
   ============================================
   - Hits          36857    36835      -22     
   - Misses        10852    10866      +14     
   - Partials       3005     3017      +12     
   ```
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata/pull/8118?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...seata/rm/datasource/undo/AbstractUndoExecutor.java](https://app.codecov.io/gh/apache/incubator-seata/pull/8118?src=pr&el=tree&filepath=rm-datasource%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Frm%2Fdatasource%2Fundo%2FAbstractUndoExecutor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cm0tZGF0YXNvdXJjZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VhdGEvcm0vZGF0YXNvdXJjZS91bmRvL0Fic3RyYWN0VW5kb0V4ZWN1dG9yLmphdmE=) | `66.87% <100.00%> (+0.84%)` | :arrow_up: |
   
   ... and [15 files with indirect coverage changes](https://app.codecov.io/gh/apache/incubator-seata/pull/8118/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/incubator-seata/pull/8118/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/8118?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </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] Use explicit columns in rollback validation query [incubator-seata]

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


##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoExecutor.java:
##########
@@ -306,10 +306,15 @@ protected TableRecords queryCurrentRecords(ConnectionProxy connectionProxy) thro
         int pkRowSize = pkRowValues.get(firstKey).size();
         List<SqlGenerateUtils.WhereSql> sqlConditions =
                 SqlGenerateUtils.buildWhereConditionListByPKs(pkNameList, pkRowSize, connectionProxy.getDbType());
+
+        String selectColumns = tableMeta.getAllColumns().keySet().stream()

Review Comment:
   The hidden columns in Oracle 19c are also present in the metadata.



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