incubator-seata
incubator-seata copied to clipboard
[WIP]optimize : reorganize the usage of task session manager(separate listener and manager)
- [ ] I have registered the PR changes.
Ⅰ. Describe what this PR did
在https://github.com/seata/seata/issues/4857的问题里,分两个pr解决
- 简单的把外部用到 非rootmanager的地方改造回同语义的rootmanager方法 https://github.com/seata/seata/pull/4858
- 这个pr把listener从sessionmanager剥离,并进行同语义的改造
按计划把第一个pr合并之后,这个pr就可以把getRetryRollbackingSessionManager()和getRetryCommittingSessionManager()这些直接删掉了
这个pr做了以下几件事
- AbstractSessionManager不再实现SessionLifecycleListener
- SessionManager不再继承SessionLifecycleListener
- 去掉所有session.addlistener的操作(因为现在已经没有类属于SessionLifecycleListener)
- SessionManager里面定义和SessionLifecycleListener同名的方法(用于处理主流程),这样AbstractSessionManager里面的方法实现无需改动,但调用方需要整改
- GlobalSession作为调用方,在所有遍历lifecycleListeners之前,优先调用SessionHolder.getRootSessionManager()的同名方法进行主逻辑处理
- AbstractSessionManager的updateGlobalSessionStatus方法要进行set status
- 单测整改(涉及sessionholder的地方要初始化,xid缺失的地方要补充)
这个pr把addlistener的操作已经全部去掉,但这个方法和listener自身机制保留(目前闲置),以后有必要再使用
由于现在SessionLifecycleListener只有被GlobalSession调用,所以只需要改好GlobalSession就可以
上图是用临时改方法名的方法用错误统计来显示全部的调用
Ⅱ. Does this pull request fix one issue?
fixes https://github.com/seata/seata/issues/4857
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
Codecov Report
Merging #4881 (0feda8b) into 2.x (4b724e2) will decrease coverage by
0.11%
. The diff coverage is100.00%
.
:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
@@ Coverage Diff @@
## 2.x #4881 +/- ##
============================================
- Coverage 48.51% 48.40% -0.11%
+ Complexity 4188 4167 -21
============================================
Files 764 764
Lines 26924 26892 -32
Branches 3348 3348
============================================
- Hits 13061 13016 -45
- Misses 12475 12479 +4
- Partials 1388 1397 +9
Impacted Files | Coverage Δ | |
---|---|---|
...java/io/seata/server/coordinator/AbstractCore.java | 54.02% <ø> (-1.04%) |
:arrow_down: |
.../java/io/seata/server/coordinator/DefaultCore.java | 47.59% <ø> (-0.65%) |
:arrow_down: |
...in/java/io/seata/server/session/SessionHolder.java | 60.18% <ø> (-1.24%) |
:arrow_down: |
...o/seata/server/coordinator/DefaultCoordinator.java | 44.89% <100.00%> (-2.12%) |
:arrow_down: |
...o/seata/server/session/AbstractSessionManager.java | 62.31% <100.00%> (+0.55%) |
:arrow_up: |
...in/java/io/seata/server/session/GlobalSession.java | 69.92% <100.00%> (-10.61%) |
:arrow_down: |
...ver/storage/db/session/DataBaseSessionManager.java | 41.17% <100.00%> (+4.33%) |
:arrow_up: |
...rage/redis/store/RedisTransactionStoreManager.java | 74.67% <0.00%> (-0.79%) |
:arrow_down: |
... and 4 more |