gaoran10 commented on a change in pull request #7856:
URL: https://github.com/apache/pulsar/pull/7856#discussion_r482867544



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java
##########
@@ -207,26 +208,39 @@ public void 
removeTransactionMetadataStore(TransactionCoordinatorID tcId) {
 
     private CompletableFuture<Void> endToTB(TxnID txnID, TxnStatus newStatus) {
         CompletableFuture<Void> resultFuture = new CompletableFuture<>();
-        List<CompletableFuture<TxnID>> commitFutureList = new ArrayList<>();
+        List<CompletableFuture<TxnID>> completableFutureList = new 
ArrayList<>();
         this.getTxnMeta(txnID).whenComplete((txnMeta, throwable) -> {
             if (throwable != null) {
                 resultFuture.completeExceptionally(throwable);
                 return;
             }
+
+            txnMeta.ackedPartitions().forEach(tbSub -> {
+                CompletableFuture<TxnID> commitFuture = new 
CompletableFuture<>();
+                if (TxnStatus.COMMITTING.equals(newStatus)) {
+                    commitFuture = tbClient.commitTxnOnSubscription(
+                            tbSub.getTopic(), tbSub.getSubscription(), 
txnID.getMostSigBits(), txnID.getLeastSigBits());
+                } else if (TxnStatus.ABORTING.equals(newStatus)) {
+                    commitFuture = tbClient.abortTxnOnSubscription(
+                            tbSub.getTopic(), tbSub.getSubscription(), 
txnID.getMostSigBits(), txnID.getLeastSigBits());
+                }
+                completableFutureList.add(commitFuture);
+            });
+
             txnMeta.producedPartitions().forEach(partition -> {
                 CompletableFuture<TxnID> commitFuture = new 
CompletableFuture<>();
                 if (TxnStatus.COMMITTING.equals(newStatus)) {
                     commitFuture = tbClient.commitTxnOnTopic(partition, 
txnID.getMostSigBits(), txnID.getLeastSigBits());
+                    // TODO commitTxnOnSubscription
                 } else if (TxnStatus.ABORTING.equals(newStatus)) {
+                    // TODO abortTxnOnTopic
                     commitFuture.completeExceptionally(new 
Throwable("Unsupported operation."));
-                } else {
-                    // Unsupported txnStatus
-                    commitFuture.completeExceptionally(new 
Throwable("Unsupported txnStatus."));

Review comment:
       I'll revert this.




----------------------------------------------------------------
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:
[email protected]


Reply via email to