Skip to content
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

optimize: build UndoItem logic #4282

Merged
merged 9 commits into from
Feb 20, 2022

Conversation

xiaochangbai
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

optimize build UndoItem logic

Ⅱ. Does this pull request fix one issue?

fixes #4280

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@xiaochangbai
Copy link
Contributor Author

不知道这样改对不对,大佬看了之后麻烦指点一下哈

@slievrly slievrly added the first-time contributor first-time contributor label Jan 12, 2022
@funky-eyes funky-eyes added this to the 1.5.0 milestone Jan 22, 2022
@funky-eyes funky-eyes added the module/rm-datasource rm-datasource module label Jan 22, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2022

Codecov Report

Merging #4282 (b791299) into develop (250bc70) will decrease coverage by 0.03%.
The diff coverage is 12.50%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #4282      +/-   ##
=============================================
- Coverage      49.02%   48.99%   -0.04%     
+ Complexity      3955     3950       -5     
=============================================
  Files            733      733              
  Lines          24974    24978       +4     
  Branches        3089     3092       +3     
=============================================
- Hits           12243    12237       -6     
- Misses         11434    11442       +8     
- Partials        1297     1299       +2     
Impacted Files Coverage Δ
...source/exec/mysql/MySQLInsertOrUpdateExecutor.java 31.07% <0.00%> (-0.36%) ⬇️
...ta/rm/datasource/exec/AbstractDMLBaseExecutor.java 54.71% <25.00%> (-4.11%) ⬇️
...n/src/main/java/io/seata/common/util/IdWorker.java 77.08% <0.00%> (-6.25%) ⬇️
.../rm/datasource/exec/BaseTransactionalExecutor.java 55.26% <0.00%> (-0.66%) ⬇️
...o/seata/server/coordinator/DefaultCoordinator.java 52.18% <0.00%> (-0.37%) ⬇️

Copy link
Contributor

@caohdgege caohdgege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes changed the title optimize:build UndoItem logic optimize: build UndoItem logic Feb 20, 2022
@funky-eyes funky-eyes merged commit a286544 into apache:develop Feb 20, 2022
@codelearner1024
Copy link

acquire before image can also be moved into the if judgement. @xiaochangbai

@a1104321118
Copy link
Contributor

a1104321118 commented Aug 3, 2022

#4280

hello, 这个这样判断有点问题,我在用 mybatis-plus 的时候,使用 saveBatch 方法,它底层用的是 Statement.executeBatch 方法,这个方法无法返回影响的行数,导致你这里的判断会失效,所以没有生成undo log;除非开启这个参数 : [rewriteBatchedStatements] ,但是性能会下降很多

相关资料:
com.mysql.cj.jdbc.ClientPreparedStatement#executeBatchedInserts
https://forums.mysql.com/read.php?39,699815,699821#msg-699821

如果使用mybatis 原生的批量插入,底层调用的 是 Statement.execute 方法,这个方法可以获取到影响的行数,没有问题;

seata 客户端版本 1.5.1
mysql 8.0

@a1104321118
Copy link
Contributor

a1104321118 commented Aug 3, 2022 via email

@xiaochangbai
Copy link
Contributor Author

#4280

hello, 这个这样判断有点问题,我在用 mybatis-plus 的时候,使用 saveBatch 方法,它底层用的是 Statement.executeBatch 方法,这个方法无法返回影响的行数,导致你这里的判断会失效,所以没有生成undo log;除非开启这个参数 : [rewriteBatchedStatements] ,但是性能会下降很多

相关资料: com.mysql.cj.jdbc.ClientPreparedStatement#executeBatchedInserts https://forums.mysql.com/read.php?39,699815,699821#msg-699821

如果使用mybatis 原生的批量插入,底层调用的 是 Statement.execute 方法,这个方法可以获取到影响的行数,没有问题;

seata 客户端版本 1.5.1 mysql 8.0

好,这个问题我看看。感谢您的反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time contributor first-time contributor module/rm-datasource rm-datasource module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

optimize build UndoItem logic
7 participants