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 2022/03/31 13:09:14 UTC

[GitHub] [pulsar] Technoboy- opened a new pull request #14973: Fix potentially unfinished CompletableFuture.

Technoboy- opened a new pull request #14973:
URL: https://github.com/apache/pulsar/pull/14973


   ### Motivation
   
   In MLTransactionMetadataStore#addProducedPartitionToTxn, `getTxnPositionPair` may complete with exception and cause the future never complete.
   https://github.com/apache/pulsar/blob/02eb31b372b2bf72350e8f6cbab552e1627e6197/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java#L260-L290
   
   https://github.com/apache/pulsar/blob/02eb31b372b2bf72350e8f6cbab552e1627e6197/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java#L435-L444
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Documentation
     
   - [x] `no-need-doc` 
   
   
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] Technoboy- commented on a change in pull request #14973: [fix][transaction] Fix potentially unfinished CompletableFuture.

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #14973:
URL: https://github.com/apache/pulsar/pull/14973#discussion_r840245223



##########
File path: pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java
##########
@@ -257,7 +257,7 @@ public void handleMetadataEntry(Position position, TransactionMetadataEntry tran
                         State.Ready, getState(), "add produced partition"));
                 return;
             }
-            getTxnPositionPair(txnID).thenAccept(txnMetaListPair -> {
+            getTxnPositionPair(txnID).thenCompose(txnMetaListPair -> {

Review comment:
       Yes, thanks for your better explanation.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] HQebupt commented on a change in pull request #14973: [fix][transaction] Fix potentially unfinished CompletableFuture.

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



##########
File path: pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java
##########
@@ -257,7 +257,7 @@ public void handleMetadataEntry(Position position, TransactionMetadataEntry tran
                         State.Ready, getState(), "add produced partition"));
                 return;
             }
-            getTxnPositionPair(txnID).thenAccept(txnMetaListPair -> {
+            getTxnPositionPair(txnID).thenCompose(txnMetaListPair -> {

Review comment:
       The origin method `getTxnPositionPair(txnID)` may throw TransactionNotFoundException, but it does not catch it. It may cause the uncompleted future. LGTM




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] Technoboy- commented on a change in pull request #14973: [fix][transaction] Fix potentially unfinished CompletableFuture.

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on a change in pull request #14973:
URL: https://github.com/apache/pulsar/pull/14973#discussion_r840245223



##########
File path: pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java
##########
@@ -257,7 +257,7 @@ public void handleMetadataEntry(Position position, TransactionMetadataEntry tran
                         State.Ready, getState(), "add produced partition"));
                 return;
             }
-            getTxnPositionPair(txnID).thenAccept(txnMetaListPair -> {
+            getTxnPositionPair(txnID).thenCompose(txnMetaListPair -> {

Review comment:
       Yes, thanks for your better explaination.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] congbobo184 merged pull request #14973: [fix][transaction] Fix potentially unfinished CompletableFuture.

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


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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