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: paramsPlaceHolder generate by StringUtils.repeat() #2776

Merged
merged 9 commits into from
Jun 24, 2020
Merged

optimize: paramsPlaceHolder generate by StringUtils.repeat() #2776

merged 9 commits into from
Jun 24, 2020

Conversation

xianlaioy
Copy link
Contributor

paramsPlaceHolder generate by StringUtils.repeat()

  1. paramsPlaceHolder generate by StringUtils.repeat()
  2. make read easy
  3. run test LogStoreDataBaseDAOTest

paramsPlaceHolder generate by StringUtils.repeat()
@slievrly slievrly added the status: waiting-for-feedback Waiting for feedback label Jun 8, 2020
@slievrly
Copy link
Member

slievrly commented Jun 8, 2020

Copy link
Contributor Author

@xianlaioy xianlaioy left a comment

Choose a reason for hiding this comment

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

remove unused import

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2020

Codecov Report

Merging #2776 into develop will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2776      +/-   ##
=============================================
- Coverage      50.18%   50.17%   -0.01%     
+ Complexity      2952     2951       -1     
=============================================
  Files            588      588              
  Lines          18938    18932       -6     
  Branches        2287     2285       -2     
=============================================
- Hits            9504     9500       -4     
  Misses          8489     8489              
+ Partials         945      943       -2     
Impacted Files Coverage Δ Complexity Δ
...a/server/storage/db/store/LogStoreDataBaseDAO.java 71.18% <100.00%> (-0.58%) 31.00 <0.00> (-3.00)
...in/java/io/seata/server/session/GlobalSession.java 84.16% <0.00%> (+0.45%) 72.00% <0.00%> (+1.00%)
...o/seata/server/coordinator/DefaultCoordinator.java 55.15% <0.00%> (+0.51%) 29.00% <0.00%> (+1.00%)

sb.append(", ");
}
}
String paramsPlaceHolder = org.apache.commons.lang.StringUtils.repeat("?",",",statuses.length);
Copy link
Member

Choose a reason for hiding this comment

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

extract repeat method to io.seata.common.util.StringUtils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's necessary.

Copy link
Member

Choose a reason for hiding this comment

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

the apache common langs jar often conflicts with other libraries. convenient direct replacement.

@l81893521 l81893521 added the module/server server module label Jun 9, 2020
xids.stream().forEach(xid -> sj.add("?"));
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getQueryBranchTransaction(brachTable, sj.toString());
List<BranchTransactionDO> rets = new ArrayList<>(length * 3);
String paramsPlaceHolder = org.apache.commons.lang.StringUtils.repeat("?",",",length);
Copy link
Member

Choose a reason for hiding this comment

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

for better readability, please add a space in the separator. ","-> ", "

@slievrly
Copy link
Member

slievrly commented Jun 9, 2020

@xianlaioy In addition, you need to format and standardize the pr title.

@slievrly slievrly removed the status: waiting-for-feedback Waiting for feedback label Jun 9, 2020
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

Copy link
Member

@jsbxyyx jsbxyyx left a comment

Choose a reason for hiding this comment

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

LGTM

@jsbxyyx jsbxyyx changed the title paramsPlaceHolder generate by StringUtils.repeat() optimize: paramsPlaceHolder generate by StringUtils.repeat() Jun 24, 2020
@jsbxyyx jsbxyyx merged commit 1b90640 into apache:develop Jun 24, 2020
@slievrly slievrly added this to the 1.3.0 milestone Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/server server module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants