liangyepianzhou commented on a change in pull request #13348:
URL: https://github.com/apache/pulsar/pull/13348#discussion_r776933347



##########
File path: 
pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java
##########
@@ -696,4 +696,33 @@ public void testEndTxnWhenCommittingOrAborting() throws 
Exception {
         commitTxn.commit();
     }
 
+    @Test
+    public void testCommittedWhenHasTxnOpFailed() throws Exception {
+        Transaction transaction = pulsarClient
+                .newTransaction()
+                .withTransactionTimeout(5, TimeUnit.SECONDS)
+                .build()
+                .get();
+
+        Producer<String> producer = pulsarClient
+                .newProducer(Schema.STRING)
+                .topic(NAMESPACE1 + "/test")
+                .sendTimeout(0, TimeUnit.SECONDS)
+                .create();
+        for (PulsarService pulsarService : getPulsarServiceList()) {
+            Field field = ManagedLedgerImpl.class.getDeclaredField("state");
+            field.setAccessible(true);
+            field.set(((MLTransactionMetadataStore) 
pulsarService.getTransactionMetadataStoreService().getStores()
+                    .get(TransactionCoordinatorID.get(0))).getManagedLedger(), 
ManagedLedgerImpl.State.Closed);
+        }
+        producer.newMessage(transaction)
+                .value("test")
+                .sendAsync();

Review comment:
       When we commit or abort a transaction, it will wait for all 
CompletableFutures to finish.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to