You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/11/09 18:12:20 UTC

[GitHub] [pulsar] gaoran10 opened a new pull request #8493: [Transaction] Register transaction metadata before send or ack messages

gaoran10 opened a new pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493


   Fixes https://github.com/streamnative/pulsar/issues/1659
   
   ### Motivation
   
   The transaction metadata registration should be the precondition of send or ack transaction messages, this guarantees TC could notify all related topic partitions and subscriptions successfully.
   
   ### Modifications
   
   1. Register topic partition info to TC before sending transaction messages.
   2. Register subscription info to TC before ack transaction messages.
   
   ### Verifying this change
   
   This change is already covered by existing tests.
   
   ### 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)
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (no)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 removed a comment on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 removed a comment on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-726139389


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 commented on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-724418587


   ef6483dbc378c5a5d52f58a148cfdef2a294735d


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui merged pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] jiazhai commented on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
jiazhai commented on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-724457663


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
sijie commented on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-726379470


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 removed a comment on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 removed a comment on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-724418587


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 edited a comment on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 edited a comment on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-724418587


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 commented on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-725061535


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 commented on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-724584203


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 closed pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 closed pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on a change in pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#discussion_r520369305



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
##########
@@ -473,30 +473,34 @@ public void negativeAcknowledge(Message<?> message) {
     protected CompletableFuture<Void> doAcknowledgeWithTxn(List<MessageId> messageIdList, AckType ackType,
                                                            Map<String,Long> properties,
                                                            TransactionImpl txn) {
-        CompletableFuture<Void> ackFuture = doAcknowledge(messageIdList, ackType, properties, txn);
+        CompletableFuture<Void> ackFuture;
         if (txn != null) {
-            txn.registerAckedTopic(getTopic(), subscription);
-            return txn.registerAckOp(ackFuture);
+            ackFuture = txn.registerAckedTopic(getTopic(), subscription)
+                    .thenCompose(ignored -> doAcknowledge(messageIdList, ackType, properties, txn));
+            txn.registerAckOp(ackFuture);

Review comment:
       Should we handle the exception here? If the metadata register failed, we can't send message or ack




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] gaoran10 commented on pull request #8493: [Transaction] Register transaction metadata before send or ack messages

Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #8493:
URL: https://github.com/apache/pulsar/pull/8493#issuecomment-726139389


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org