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

bugfix: fix register branch and flush undolog when affect row was zero #3522

Merged
merged 4 commits into from
Apr 15, 2021
Merged

bugfix: fix register branch and flush undolog when affect row was zero #3522

merged 4 commits into from
Apr 15, 2021

Conversation

slievrly
Copy link
Member

Signed-off-by: slievrly slievrly@163.com

Ⅰ. Describe what this PR did

bugfix: fix register branch and flush undolog when affect row was zero

Ⅱ. Does this pull request fix one issue?

fix #3521

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@@ -279,10 +278,12 @@ protected void prepareUndoLog(TableRecords beforeImage, TableRecords afterImage)

TableRecords lockKeyRecords = sqlRecognizer.getSQLType() == SQLType.DELETE ? beforeImage : afterImage;
String lockKeys = buildLockKey(lockKeyRecords);
connectionProxy.appendLockKey(lockKeys);
if (null != lockKeys) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe you can put it in the connectionProxy# appendLockKey function

Copy link
Member Author

Choose a reason for hiding this comment

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

If you put code in connectionProxy# appendLockKey, it will still execute L284~L285.

@funky-eyes
Copy link
Contributor

please add test case

@codecov-io
Copy link

codecov-io commented Feb 18, 2021

Codecov Report

Merging #3522 (072ba71) into develop (1de031d) will increase coverage by 0.01%.
The diff coverage is 75.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3522      +/-   ##
=============================================
+ Coverage      52.15%   52.16%   +0.01%     
+ Complexity      3510     3508       -2     
=============================================
  Files            638      638              
  Lines          21108    21109       +1     
  Branches        2613     2615       +2     
=============================================
+ Hits           11009    11012       +3     
+ Misses          9014     9012       -2     
  Partials        1085     1085              
Impacted Files Coverage Δ Complexity Δ
.../rm/datasource/exec/BaseTransactionalExecutor.java 58.77% <75.00%> (-0.46%) 27.00 <0.00> (ø)
...n/src/main/java/io/seata/common/util/IdWorker.java 83.33% <0.00%> (+6.25%) 12.00% <0.00%> (+1.00%)

@funky-eyes funky-eyes added this to the 1.5.0 milestone Feb 21, 2021
@funky-eyes funky-eyes added module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug. labels Feb 21, 2021
@@ -279,10 +278,12 @@ protected void prepareUndoLog(TableRecords beforeImage, TableRecords afterImage)

TableRecords lockKeyRecords = sqlRecognizer.getSQLType() == SQLType.DELETE ? beforeImage : afterImage;
String lockKeys = buildLockKey(lockKeyRecords);
connectionProxy.appendLockKey(lockKeys);
if (null != lockKeys) {
Copy link
Contributor

Choose a reason for hiding this comment

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

the method return value , is from :
StringBuilder sb = new StringBuilder(); xxx return sb.toString();
It can not use null != lockkeys, should use if(!StringUtils.isBlank(lockKeys))

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Member Author

Choose a reason for hiding this comment

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

if (rowsIncludingPK.size() == 0) {
            return null;
        }

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

Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

seata1.3 at模式下 偶发出现 locktable写入时主键重复
7 participants