seata DefaultTransactionManager ignore server error(ResultCode=Failed) and return GlobalStatus

vm0i2vca  于 22天前  发布在  其他
关注(0)|答案(2)|浏览(18)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

我在编写mock-server测试case的时候发现,目前DefaultTransactionManager会忽略除begin以外的所有异常,然后正常的返回一个status。按我理解这里的情况是分两种的:
第一种:TC正常接收到2阶段请求且落库了,然后在后续过程中遇到问题,此时TC可能不希望用户做任何处理,只要等待TC重试调度即可。
另一种情况:TC接收请求后遇到了意外的异常,甚至没有持久化成功但可以返回rpc请求,客户端应该是需要有所感知的,所以我认为TM至少需要打印错误日志。
也有可能是还有其他处理逻辑我没看到,不过按照预期这种情况mock是需要能感知的。如果有相关处理逻辑建议还是要移动回DefaultTransactionManager

While writing test cases for a mock-server, I discovered that the current DefaultTransactionManager ignores all exceptions except 'begin', and then returns a status normally. In my understanding, there are two scenarios here:

  1. The TC normally receives a 2-phase request and logs it, but encounters issues in subsequent processes. In this scenario, the TC might not wish for the user to take any action, simply waiting for the TC to retry scheduling may suffice.
  2. In another scenario, the TC encounters an unexpected exception after receiving a request. In this case, the client should be made aware of the issue, so I believe the TM should at least log an error.

There might be other processing logic that I haven't noticed. However, as per expectation, such scenarios should be detectable in a mock. If there are relevant processing mechanisms, it's advisable to move them back to the DefaultTransactionManager.

Ⅱ. Describe what happened

Ⅲ. 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:
fhity93d

fhity93d1#

Are you referring to returning detailed information about the exception to the client?

zour9fqk

zour9fqk2#

Are you referring to returning detailed information about the exception to the client?

My scenario: the TM calls globalReport directly, the TC receives it and for some reason has a TransactionException (probably a transaction status issue) and then returns code=fail and also globalstatus (copied from the request). It
doesn't make sense that after the TM gets the response it doesn't care about the resultCode but just gets the status, the TM will think that this globalReport was successful, which could lead to business problems.

我的场景:TM直接调用globalReport,TC收到后因为某些原因出现了TransactionException(可能是事务状态问题),然后返回了code=fail,同时也返回了globalstatus(从请求里复制的)。在TM获得response后不关心resultCode而直接取得了status,这样应该不合理吧?TM会认为这次globalReport是成功的,可能导致业务问题。

相关问题