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: UUIDGenerator generates duplicated id #2972

Merged
merged 2 commits into from
Aug 5, 2020

Conversation

yujianfei1986
Copy link
Contributor

Ⅰ. Describe what this PR did

UUIDGenerator类的generateUUID()方法在高并发情况下,会生成重复的id

Ⅱ. Does this pull request fix one issue?

高并发压测发现

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

Ⅳ. Describe how to verify it

高并发压测,不会再出现重复的branchid

Ⅴ. Special notes for reviews

UUIDGenerator generate duplicated id

@yujianfei1986 yujianfei1986 changed the title Bugfix: UUIDGenerator generate duplicated id Bugfix: UUIDGenerator generates duplicated id Aug 4, 2020
@codecov-commenter
Copy link

codecov-commenter commented Aug 4, 2020

Codecov Report

Merging #2972 into develop will increase coverage by 0.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2972      +/-   ##
=============================================
+ Coverage      50.10%   50.21%   +0.11%     
  Complexity      3053     3053              
=============================================
  Files            599      599              
  Lines          19438    19463      +25     
  Branches        2351     2396      +45     
=============================================
+ Hits            9739     9774      +35     
- Misses          8692     8704      +12     
+ Partials        1007      985      -22     
Impacted Files Coverage Δ Complexity Δ
...n/src/main/java/io/seata/common/util/IdWorker.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...dubbo/ApacheDubboTransactionPropagationFilter.java 55.00% <0.00%> (-1.42%) 8.00% <0.00%> (ø%)
...baba/AlibabaDubboTransactionPropagationFilter.java 52.38% <0.00%> (-1.28%) 8.00% <0.00%> (ø%)
...o/seata/server/storage/redis/lock/RedisLocker.java 39.53% <0.00%> (-0.63%) 12.00% <0.00%> (ø%)
...in/java/io/seata/server/session/GlobalSession.java 83.71% <0.00%> (-0.55%) 71.00% <0.00%> (ø%)
...rage/redis/store/RedisTransactionStoreManager.java 36.05% <0.00%> (-0.53%) 20.00% <0.00%> (ø%)
...java/io/seata/spring/tcc/TccActionInterceptor.java 11.36% <0.00%> (-0.27%) 2.00% <0.00%> (ø%)
...n/java/io/seata/rm/datasource/ConnectionProxy.java 28.00% <0.00%> (-0.23%) 13.00% <0.00%> (ø%)
...ta/core/rpc/netty/AbstractNettyRemotingClient.java 19.04% <0.00%> (-0.21%) 8.00% <0.00%> (ø%)
...ta/core/rpc/netty/AbstractNettyRemotingServer.java 0.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
... and 26 more

} else {
sequence = 0L;
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
Copy link
Contributor

Choose a reason for hiding this comment

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

the sequence is different, why cause the duplicated id?

Copy link
Contributor

Choose a reason for hiding this comment

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

my fault.

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

@l81893521 l81893521 added this to the 1.4.0 milestone Aug 5, 2020
@l81893521 l81893521 added the module/common common module label Aug 5, 2020
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

@l81893521 l81893521 merged commit 61af8ca into apache:develop Aug 5, 2020
l81893521 pushed a commit to l81893521/seata that referenced this pull request Oct 22, 2020
hicf pushed a commit to hicf/seata that referenced this pull request Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/common common module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants