-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[Transaction] Handle Acknowledge In The Transaction #7856
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
Conversation
429d5ae
to
40bb080
Compare
/pulsarbot run-failure-checks |
3b7d11f
to
048cf9e
Compare
/pulsarbot run-failure-checks |
public void addSubscriptionToTxn(TxnID txnID, String topic, String subscription) | ||
throws TransactionCoordinatorClientException { | ||
try { | ||
addSubscriptionToTxnAsync(txnID, topic, subscription); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method will return before processing the add subscription to the txn, is this an expected behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I miss calling the get().
.setTopic(topic) | ||
.setSubscription(subscription) | ||
.build(); | ||
return handler.addSubscriptionToTxn(txnID, Lists.newArrayList(sub)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Singleton list is more suitable here. Or maybe you add a thread-local list to avoid introduce many list instance
} else { | ||
// Unsupported txnStatus | ||
commitFuture.completeExceptionally(new Throwable("Unsupported txnStatus.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll revert this.
// dispatcher.redeliverUnacknowledgedMessages(consumer, (List<PositionImpl>) | ||
// (List<?>)pendingAckMessageForCurrentTxn.values()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a useful change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'll revert this.
*/ | ||
@Data | ||
@Builder | ||
public class TransactionSubscription implements Comparable<TransactionSubscription> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is the same struct in PulsarApi.proto named Subscription
, maybe you can use that one directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem, I can't override the hashCode
method of the Subscription
and it can't be used in a Set collection.
7e07070
to
fb9ddf0
Compare
/pulsarbot run-failure-checks |
Fix https://github.com/streamnative/pulsar/issues/1307 Master Issue: apache#2664 ### Motivation Handle acknowledge in the transaction. ### Modifications 1. Register subscription to the transaction metadata store. 2. Make the ack command carry the transaction information. 3. When committing a transaction, commit every subscription in the transaction.
Fix https://github.com/streamnative/pulsar/issues/1307 Master Issue: apache#2664 ### Motivation Handle acknowledge in the transaction. ### Modifications 1. Register subscription to the transaction metadata store. 2. Make the ack command carry the transaction information. 3. When committing a transaction, commit every subscription in the transaction.
Fix https://github.com/streamnative/pulsar/issues/1307 Master Issue: apache#2664 ### Motivation Handle acknowledge in the transaction. ### Modifications 1. Register subscription to the transaction metadata store. 2. Make the ack command carry the transaction information. 3. When committing a transaction, commit every subscription in the transaction.
Fix https://github.com/streamnative/pulsar/issues/1307
Master Issue: #2664
Motivation
Handle acknowledge in the transaction.
Modifications
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation