incubator-seata
incubator-seata copied to clipboard
task session manager chaos
Why you need it?
Is your feature request related to a problem? Please describe in details 目前SessionHolder里面带有4个session manager(root/async_commit/retry_commit/retry_rollback),这4个manager在很多场景下都等价,所以root以外的manager大多被滥用,造成代码难读和维护困难,在进行新功能开发时也无法收敛到同一处,例如: 以下两个写法是等价的(都是移除全局事务)
SessionHolder.getRetryCommittingSessionManager().removeGlobalSession(committingSession);
SessionHolder.getRootSessionManager().removeGlobalSession(committingSession);
但以下两个写法是不一定等价的(在db/redis模式下用root是真正的新增,而用其他的则是更新,这和方法名称表达也不一致。)
SessionHolder.getRetryCommittingSessionManager().addGlobalSession(session);
SessionHolder.getRootSessionManager().addGlobalSession(session);
另一个问题是在globalsession里面addSessionLifecycleListener,可能会让globalsession持有多个manager,在某些操作(比如changestatus的时候,就会出现调用多次manager的情况,如果他们行为一致,那就是多余操作,如果他们行为不一致,那后果可能更严重)
How it could be?
A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it. 建议分两步进行 第一步将 globalsession的增删查改操作都改回root manager(方便与之有关的功能编写) 第二步是以后真正把这个listener机制废除
Other related information
Add any other context or screenshots about the feature request here.