Skip to content

[Bug] [txn] callback of commit/abort is not accurate in transaction #19747

@TakaHiR07

Description

@TakaHiR07

Search before asking

  • I searched in the issues and found nothing similar.

Version

master branch

Minimal reproduce step

When I reading the transaction code and pip-31,I found the implementation of CommandEndTxn is not as pip-31 described. Now the txn client execute commit() or abort() would wait the reponse from server until txn status become committed or aborted.

企业微信截图_47c1b690-de98-4380-a676-804d5b3c28d6

企业微信截图_7990a84a-28a4-4f95-af32-96813d9dbf1a

And now the callback of commit() can not reflect the actual status of txn. For example, 2 case may occur

  1. broker may be unavailable before server update txnstatus to committing
  2. broker may be unavailable between committing and committed

For case 2, may throw CoordinatorNotFound exception to client, then client would retry txn.commit(). But when broker recover, coordinator would firstly recover the previous transactions. Then broker process the retry-commit, may return InvalidTxnStatus or transactionNotFound to client, Which client would regard txn commit error, but actually it is success.

Why we don't respond success to client when server update txn-status to committing ? @congbobo184 @liangyepianzhou

What did you expect to see?

throw exception in commit.callback, but txn is success

What did you see instead?

commit.callback can reflect the accurate status

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

Staletype/bugThe PR fixed a bug or issue reported a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions