[Bug] [txn] callback of commit/abort is not accurate in transaction
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/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.


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?
- [X] I'm willing to submit a PR!
Contributor guide
Assessment
This issue has not been assessed yet.