liangyepianzhou commented on a change in pull request #13348:
URL: https://github.com/apache/pulsar/pull/13348#discussion_r776929646
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/transaction/TransactionImpl.java
##########
@@ -163,25 +191,25 @@ public synchronized void
registerCumulativeAckConsumer(ConsumerImpl<?> consumer)
public CompletableFuture<Void> commit() {
return checkIfOpenOrCommitting().thenCompose((value) -> {
CompletableFuture<Void> commitFuture = new CompletableFuture<>();
- this.state = State.COMMITTING;
- allOpComplete().whenComplete((v, e) -> {
- if (e != null) {
- abort().whenComplete((vx, ex) ->
commitFuture.completeExceptionally(e));
- } else {
- tcClient.commitAsync(new TxnID(txnIdMostBits,
txnIdLeastBits))
- .whenComplete((vx, ex) -> {
- if (ex != null) {
- if (ex instanceof
TransactionNotFoundException
- || ex instanceof
InvalidTxnStatusException) {
- this.state = State.ERROR;
- }
- commitFuture.completeExceptionally(ex);
- } else {
- this.state = State.COMMITTED;
- commitFuture.complete(vx);
+ executedFuture.thenRun(() -> {
Review comment:
* We should wait all the ops are completely.
* If we return an exception, users have to use a loop and try catch to
commit the txn.
--
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]