Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ptyin
Copy link
Member

@ptyin ptyin commented Nov 11, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Fix incorrect metric report.

It's actually a accidental code error. The conditions in

https://github.com/seata/seata/blob/8192138895ada3cc7cd09977f3219ed8371c17ae/server/src/main/java/io/seata/server/session/SessionHelper.java#L149

and in

https://github.com/seata/seata/blob/8192138895ada3cc7cd09977f3219ed8371c17ae/server/src/main/java/io/seata/server/session/SessionHelper.java#L221

intend to distinguish whether retryGlobal is true or false. Therefore, retryGlobal should be evaluated instead of DELAY_HANDLE_SESSION.

Ⅱ. Does this pull request fix one issue?

fixes #6016

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

globalSession.changeGlobalStatus(GlobalStatus.Committed);
}
globalSession.end();
if (!DELAY_HANDLE_SESSION) {
Copy link
Contributor

@funky-eyes funky-eyes Nov 11, 2023

Choose a reason for hiding this comment

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

file和raft模式时,外层的if是不成立的,所以需要在这里打end的点和after的点,而其它模式在二阶段决议时是走的else逻辑,committed已经在二阶段决议时完成了,所以在这不需要再打点
file and raft mode, the outer if is not established, so you need to hit the end of the point here and after the point, while the other modes in the two-stage resolution is to go to the else logic, committed has been completed in the two-stage resolution, so no need to hit the point here!

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it. Leave this line unchanged, and modify the MetricsPublisher.postSessionDoneEvent(globalSession, false, false); to MetricsPublisher.postSessionDoneEvent(globalSession, retryGlobal, false); in the inner block. I think that makes more sense.

@codecov
Copy link

codecov bot commented Nov 11, 2023

Codecov Report

Merging #6018 (8c85707) into 2.x (bc7d212) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6018      +/-   ##
============================================
+ Coverage     49.59%   49.67%   +0.08%     
- Complexity     4766     4776      +10     
============================================
  Files           911      911              
  Lines         31316    31316              
  Branches       3773     3773              
============================================
+ Hits          15530    15557      +27     
+ Misses        14253    14225      -28     
- Partials       1533     1534       +1     
Files Coverage Δ
...in/java/io/seata/server/session/SessionHelper.java 49.37% <100.00%> (ø)

... and 10 files with indirect coverage changes

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

@funky-eyes funky-eyes added this to the 2.0.0 milestone Nov 11, 2023
@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. module/server server module labels Nov 11, 2023
@funky-eyes funky-eyes requested a review from slievrly November 11, 2023 08:13
@funky-eyes funky-eyes merged commit 93a7fa1 into apache:2.x Nov 11, 2023
@ptyin ptyin mentioned this pull request Nov 12, 2023
1 task
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/server server module type: bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate commit event publishing causes incorrect transaction metric

2 participants