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

[Transaction] Fix end transaction retry problem. #10131

Conversation

congbobo184
Copy link
Contributor

Motivation

When transaction in aborting or committing status, we retry endTransaction and update status in TransactionMetadataStore will throw InvalidTxnStatusException, it will not retry. so we should judge the Transaction status try to retry.

implement

  1. When Transaction status in OPENstatus, we can updateStatus by TransactionMetadataStore.
  2. When Transaction status in Committing or Aborting status, we should judge the TxnAction, if txnAction corresponds to the TxnStatus only endTxnInTransactionBuffer, if not we don't do any operation.
  3. When Transaction status in another status, don't need to handle.
  4. When TransactionNotFoundException or CoordinatorNotFoundException can stop retry op.

Verifying this change

Add the tests for it

Does this pull request potentially affect one of the following parts:
If yes was chosen, please highlight the changes

Dependencies (does it add or upgrade a dependency): (no)
The public API: (no)
The schema: (no)
The default values of configurations: (no)
The wire protocol: (no)
The rest endpoints: (no)
The admin cli options: (no)
Anything that affects deployment: (no)

@codelipenghui codelipenghui merged commit 3d7a6ba into apache:master Apr 8, 2021
wangjialing218 pushed a commit to wangjialing218/pulsar that referenced this pull request Apr 9, 2021
## Motivation
When transaction in aborting or committing status, we retry endTransaction and update status in ```TransactionMetadataStore``` will throw ```InvalidTxnStatusException```, it will not retry. so we should judge the Transaction status try to retry.

## implement
1. When Transaction status in ```OPEN```status, we can updateStatus by ```TransactionMetadataStore```.
2. When Transaction status in ```Committing``` or ```Aborting``` status, we should judge the ```TxnAction```, if txnAction corresponds to the ```TxnStatus``` only ```endTxnInTransactionBuffer```, if not we don't do any operation.
3. When Transaction status in another status, don't need to handle.
4. When ```TransactionNotFoundException``` or ```CoordinatorNotFoundException``` can stop retry op.
### Verifying this change
Add the tests for it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants