[improve][txn] Add getState in transaction for client API - #17423
Conversation
|
I hope it can be cherry-picked to release branches from |
|
@Anonymitaet Please help review the Java Doc |
Anonymitaet
left a comment
There was a problem hiding this comment.
Feel free to correct me if my understanding is inaccurate, thanks!
…ransaction/Transaction.java Co-authored-by: Anonymitaet <50226895+Anonymitaet@users.noreply.github.com>
…state_interface' into congbobo184_txn_add_transaction_state_interface
|
@Anonymitaet @codelipenghui I have fixed the comments, please review again. Thanks! :) |
Anonymitaet
left a comment
There was a problem hiding this comment.
Thanks for your contribution! Approved from a technical writing perspective. 😊
There was a problem hiding this comment.
@congbobo184 would you mind to explain a case where the user needs to know the state of the transaction object? could you explain what are the actions they can take based on the state?
I'm ok with the pull itself but since we're adding it to the public API (and maintain it forever even if the internal transaction mechanism changes) we need a strong reason
|
@nicoloboschi I see a transaction production user. They are using |
…_transaction_state_interface
### Motivation
now `org.apache.pulsar.client.api.transaction.Transaction` dont have a interface for user to get the transaction state.
user can get the transaction state to do user's own op.
### Modifications
1. add the interface in `org.apache.pulsar.client.api.transaction.Transaction` `getState`
2. TransactionImpl implement the interface
```
* Get transaction state.
*
* @return {@link State} the state of the transaction.
*/
State getState();
```
### Verifying this change
add the test
(cherry picked from commit a9531db)
### Motivation
now `org.apache.pulsar.client.api.transaction.Transaction` dont have a interface for user to get the transaction state.
user can get the transaction state to do user's own op.
### Modifications
1. add the interface in `org.apache.pulsar.client.api.transaction.Transaction` `getState`
2. TransactionImpl implement the interface
```
* Get transaction state.
*
* @return {@link State} the state of the transaction.
*/
State getState();
```
### Verifying this change
add the test
(cherry picked from commit a9531db)
### Motivation
now `org.apache.pulsar.client.api.transaction.Transaction` dont have a interface for user to get the transaction state.
user can get the transaction state to do user's own op.
### Modifications
1. add the interface in `org.apache.pulsar.client.api.transaction.Transaction` `getState`
2. TransactionImpl implement the interface
```
* Get transaction state.
*
* @return {@link State} the state of the transaction.
*/
State getState();
```
### Verifying this change
add the test
(cherry picked from commit a9531db)
### Motivation
now `org.apache.pulsar.client.api.transaction.Transaction` dont have a interface for user to get the transaction state.
user can get the transaction state to do user's own op.
### Modifications
1. add the interface in `org.apache.pulsar.client.api.transaction.Transaction` `getState`
2. TransactionImpl implement the interface
```
* Get transaction state.
*
* @return {@link State} the state of the transaction.
*/
State getState();
```
### Verifying this change
add the test
(cherry picked from commit a9531db)
(cherry picked from commit db4fbfb)
now `org.apache.pulsar.client.api.transaction.Transaction` dont have a interface for user to get the transaction state.
user can get the transaction state to do user's own op.
1. add the interface in `org.apache.pulsar.client.api.transaction.Transaction` `getState`
2. TransactionImpl implement the interface
```
* Get transaction state.
*
* @return {@link State} the state of the transaction.
*/
State getState();
```
add the test
(cherry picked from commit a9531db)
|
Cherry-picked by #19834 |
Motivation
now
org.apache.pulsar.client.api.transaction.Transactiondont have a interface for user to get the transaction state.user can get the transaction state to do user's own op.
Modifications
org.apache.pulsar.client.api.transaction.TransactiongetStateVerifying this change
add the test
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation
Does this pull request introduce a new feature? (yes)
If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
If a feature is not applicable for documentation, explain why?
If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
doc-not-needed