-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix #853 change delete undolog to batch delete #856
fix #853 change delete undolog to batch delete #856
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #856 +/- ##
=============================================
+ Coverage 38.05% 38.29% +0.24%
- Complexity 1005 1013 +8
=============================================
Files 220 220
Lines 8452 8499 +47
Branches 1015 1023 +8
=============================================
+ Hits 3216 3255 +39
- Misses 4852 4859 +7
- Partials 384 385 +1
Continue to review full report at Codecov.
|
rm-datasource/src/main/java/io/seata/rm/datasource/AsyncWorker.java
Outdated
Show resolved
Hide resolved
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.
I left some comment
rm-datasource/src/main/java/io/seata/rm/datasource/AsyncWorker.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/undo/UndoLogManager.java
Outdated
Show resolved
Hide resolved
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
…ure_batch_delete_undolog
…hub-ygy/fescar into feature_batch_delete_undolog
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.
@@ -171,15 +175,33 @@ private void doBranchCommits() { | |||
continue; | |||
} | |||
List<Phase2Context> contextsGroupedByResourceId = entry.getValue(); | |||
Set<String> xids = new LinkedHashSet<>(UNDOLOG_DELETE_LIMIT_SIZE); |
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.
SIZE always 2^n
int xidSize = xids.size(); | ||
int branchIdSize = branchIds.size(); | ||
String batchDeleteSql = toBatchDeleteUndoLogSql(xidSize, branchIdSize,limitSize); | ||
PreparedStatement deletePST = conn.prepareStatement(batchDeleteSql); |
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.
PreparedStatement will be invalid cause by the number different
appendInParam(xidSize, sqlBuilder); | ||
sqlBuilder.append(" AND xid IN "); | ||
appendInParam(branchIdSize, sqlBuilder); | ||
sqlBuilder.append(" LIMIT ").append(limitSize); |
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.
need limit?
Ⅰ. Describe what this PR did
change delete undolog to batch delete
Ⅱ. Does this pull request fix one issue?
fix #853
Ⅲ. Why don't you add test cases (unit test/integration test)?
UndoLogManagerTest
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews