eolivelli commented on a change in pull request #13348:
URL: https://github.com/apache/pulsar/pull/13348#discussion_r775167952
##########
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:
Here we can have a race.
Because we are not waiting for this CompletableFuture to finish, so we could
succeed in committing the transaction is the send op has not been processed but
the server
--
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]