incubator-seata icon indicating copy to clipboard operation
incubator-seata copied to clipboard

optimize: Prohibit registration of TCC resources with the same name

Open PleaseGiveMeTheCoke opened this issue 1 year ago • 8 comments

  • [ ] I have registered the PR changes.

Ⅰ. Describe what this PR did

Check when registering TCC resources, if a resource with the same name already exists, determine if it is a parent-child relationship, if not, prevent the application from starting by throwing an exception.

注册TCC资源时进行检查,如果已经存在相同名称的资源,判断是否是父子类关系,如果不是,通过抛出异常的方式阻止应用启动

Ⅱ. Does this pull request fix one issue?

https://github.com/seata/seata/issues/6088

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

PleaseGiveMeTheCoke avatar Nov 28 '23 12:11 PleaseGiveMeTheCoke

Codecov Report

Merging #6091 (f6d5517) into 2.x (5563492) will decrease coverage by 0.03%. The diff coverage is 29.16%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6091      +/-   ##
============================================
- Coverage     48.94%   48.91%   -0.03%     
- Complexity     4775     4779       +4     
============================================
  Files           913      914       +1     
  Lines         31710    31728      +18     
  Branches       3827     3829       +2     
============================================
  Hits          15521    15521              
- Misses        14653    14661       +8     
- Partials       1536     1546      +10     
Files Coverage Δ
.../common/exception/RepeatRegistrationException.java 0.00% <0.00%> (ø)
.../main/java/io/seata/rm/tcc/TCCResourceManager.java 15.00% <38.88%> (+3.23%) :arrow_up:

... and 6 files with indirect coverage changes

codecov[bot] avatar Nov 28 '23 13:11 codecov[bot]

please resolve conflicts

leizhiyuan avatar Nov 29 '23 09:11 leizhiyuan

From the perspective of internal practical experience, share my suggestions:

  1. The resource name should be globally unique.
  2. Annotations to the interface, do not allow multiple implementation classes, single responsibility.

你的意思是将定义TCC资源的注解直接移动到接口上而不是某个方法上吗? Do you mean moving the annotations defining the TCC resources directly to the interface instead of to a method?

PleaseGiveMeTheCoke avatar Dec 04 '23 06:12 PleaseGiveMeTheCoke

LGTM

pengten avatar Dec 05 '23 06:12 pengten

LGTM

wt-better avatar Dec 21 '23 12:12 wt-better

There are some conflicting files, please fix.

wt-better avatar Dec 24 '23 06:12 wt-better

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (e590de5) 48.95% compared to head (852f05c) 48.98%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6091      +/-   ##
============================================
+ Coverage     48.95%   48.98%   +0.02%     
- Complexity     4778     4781       +3     
============================================
  Files           915      916       +1     
  Lines         31892    31910      +18     
  Branches       3853     3855       +2     
============================================
+ Hits          15613    15631      +18     
+ Misses        14720    14718       -2     
- Partials       1559     1561       +2     
Files Coverage Δ
.../common/exception/RepeatRegistrationException.java 0.00% <0.00%> (ø)
.../main/java/io/seata/rm/tcc/TCCResourceManager.java 15.00% <38.88%> (+3.23%) :arrow_up:

... and 3 files with indirect coverage changes

codecov-commenter avatar Dec 24 '23 15:12 codecov-commenter

There are some conflicting files, please fix.

Thanks for the heads up, I have resolved the conflict

PleaseGiveMeTheCoke avatar Dec 24 '23 15:12 PleaseGiveMeTheCoke

I can't merge this pr due to another conflict, please fix it.

funky-eyes avatar Mar 02 '24 13:03 funky-eyes