-
Notifications
You must be signed in to change notification settings - Fork 8.9k
bugfix: fix could not rollback when insert the table with multiple key #6077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: fix could not rollback when insert the table with multiple key #6077
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6077 +/- ##
============================================
+ Coverage 49.29% 49.38% +0.09%
- Complexity 4800 4805 +5
============================================
Files 913 913
Lines 31677 31678 +1
Branches 3825 3826 +1
============================================
+ Hits 15614 15645 +31
+ Misses 14514 14487 -27
+ Partials 1549 1546 -3
|
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
| * @param columnName the column name | ||
| * @return the column name in sql | ||
| */ | ||
| protected String getColumnNameInSQL(String columnName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要移动这段代码位置?而不是在它后面增加新方法?
Why move this piece of code instead of adding the new method after it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because reordering the type of method it looks more beautiful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because reordering the type of method it looks more beautiful.
那为什么不是将getColumnNamesInSQLList 挪到上面?
So why not move getColumnNamesInSQLList to the top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 method of getColumnNamesWithTablePrefix and 3 method of getColumnNameInSQL. I just put it together
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
| return limitCondition; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| /** | |
| * Gets column name in sql. | |
| * | |
| * @param columnName the column name | |
| * @return the column name in sql | |
| */ | |
| protected String getColumnNameInSQL(String columnName) { | |
| String tableAlias = sqlRecognizer.getTableAlias(); | |
| return tableAlias == null ? columnName : tableAlias + "." + columnName; | |
| } | |
| /** | |
| * Gets column names in sql. | |
| * | |
| * @param columnNames the column names | |
| * @return | |
| */ | |
| protected List<String> getColumnNamesInSQLList(List<String> columnNames) { | |
| List<String> columnNameWithTableAlias = new ArrayList<>(); | |
| for (String columnName : columnNames) { | |
| columnNameWithTableAlias.add(this.getColumnNameInSQL(columnName)); | |
| } | |
| return columnNameWithTableAlias; | |
| } | |
| /** | ||
| * Gets column name in sql. | ||
| * | ||
| * @param columnName the column name | ||
| * @return the column name in sql | ||
| */ | ||
| protected String getColumnNameInSQL(String columnName) { | ||
| String tableAlias = sqlRecognizer.getTableAlias(); | ||
| return tableAlias == null ? columnName : tableAlias + "." + columnName; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| * Gets column name in sql. | |
| * | |
| * @param columnName the column name | |
| * @return the column name in sql | |
| */ | |
| protected String getColumnNameInSQL(String columnName) { | |
| String tableAlias = sqlRecognizer.getTableAlias(); | |
| return tableAlias == null ? columnName : tableAlias + "." + columnName; | |
| } |
| /** | ||
| * Gets column names in sql. | ||
| * | ||
| * @param columnNames the column names | ||
| * @return | ||
| */ | ||
| protected List<String> getColumnNamesInSQLList(List<String> columnNames) { | ||
| List<String> columnNameWithTableAlias = new ArrayList<>(); | ||
| for (String columnName : columnNames) { | ||
| columnNameWithTableAlias.add(this.getColumnNameInSQL(columnName)); | ||
| } | ||
| return columnNameWithTableAlias; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| * Gets column names in sql. | |
| * | |
| * @param columnNames the column names | |
| * @return | |
| */ | |
| protected List<String> getColumnNamesInSQLList(List<String> columnNames) { | |
| List<String> columnNameWithTableAlias = new ArrayList<>(); | |
| for (String columnName : columnNames) { | |
| columnNameWithTableAlias.add(this.getColumnNameInSQL(columnName)); | |
| } | |
| return columnNameWithTableAlias; | |
| } |
4e1d3c9 to
f00d469
Compare
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/test/java/io/seata/rm/datasource/exec/UpdateExecutorTest.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/test/java/io/seata/rm/datasource/exec/UpdateExecutorTest.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/test/java/io/seata/rm/datasource/exec/UpdateExecutorTest.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
Co-authored-by: funkye <[email protected]>
…ExecutorTest.java Co-authored-by: funkye <[email protected]>
…ansactionalExecutor.java Co-authored-by: funkye <[email protected]>
…ExecutorTest.java Co-authored-by: funkye <[email protected]>
…ExecutorTest.java Co-authored-by: funkye <[email protected]>
funky-eyes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #6076
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews