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

Repeatedly executed hook in TransactionalTemplate #5595

Closed
1 task
Bughue opened this issue May 22, 2023 · 1 comment · Fixed by #5997
Closed
1 task

Repeatedly executed hook in TransactionalTemplate #5595

Bughue opened this issue May 22, 2023 · 1 comment · Fixed by #5997
Assignees
Labels
type: bug Category issues or prs related to bug.

Comments

@Bughue
Copy link
Contributor

Bughue commented May 22, 2023

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

#5594 里修复了日志重复打印的问题,但hook重复执行依然存在。以begin为例子,每次切面进来时会先执行hook再执行tx.begin()。
image
在tx.begin()里面会有 判断role != GlobalTransactionRole.Launcher并直接返回,但before和after的hook依然执行了,这个不太符合事务传播的逻辑,因为根本就没有新开启事务
image

同理,在commit和rollback都有这种问题。大家可以讨论一下是不是要改成只执行一次。
另外我有考虑过,如果把一些关键参数给到hook,用户就能自行决定,不过这样做有点重,可能没有必要。
如果确认需要改成执行一次的话,我可以fix掉

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Minimal yet complete reproducer code (or URL to code):

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version(e.g. java -version):
  • Seata client/server version:
  • Database version:
  • OS(e.g. uname -a):
  • Others:
@funky-eyes funky-eyes added the type: bug Category issues or prs related to bug. label May 22, 2023
@slievrly
Copy link
Member

"Begin/Commit/Rollback" are hooks designed for Global Transaction Manager, and they should only be executed once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants