codelipenghui commented on code in PR #21540:
URL: https://github.com/apache/pulsar/pull/21540#discussion_r1389025688


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1734,16 +1731,14 @@ public void openLedgerComplete(ManagedLedger ledger, 
Object ctx) {
                                         .exceptionally((ex) -> {
                                             log.warn("Replication or dedup 
check failed."
                                                     + " Removing topic from 
topics list {}, {}", topic, ex);
-                                            
persistentTopic.getTransactionBuffer()
-                                                    .closeAsync()
-                                                    .exceptionally(t -> {
-                                                        log.error("[{}] Close 
transactionBuffer failed", topic, t);
-                                                        return null;
-                                                    });
-                                            
persistentTopic.stopReplProducers().whenCompleteAsync((v, exception) -> {
-                                                topics.remove(topic, 
topicFuture);
-                                                
topicFuture.completeExceptionally(ex);
-                                            }, executor());
+                                            executor().submit(() -> {
+                                                
persistentTopic.close().whenComplete((ignore, closeEx) -> {
+                                                    if (closeEx != null) {
+                                                        log.warn("{} Get an 
error when closing topic.", topic, closeEx);

Review Comment:
   ```suggestion
                                                           log.warn("[{}] Get 
an error when closing topic.", topic, closeEx);
   ```



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1716,16 +1716,13 @@ public void openLedgerComplete(ManagedLedger ledger, 
Object ctx) {
                                                 // Check create persistent 
topic timeout.
                                                 log.warn("{} future is already 
completed with failure {}, closing the"
                                                         + " topic", topic, 
FutureUtil.getException(topicFuture));
-                                                
persistentTopic.getTransactionBuffer()
-                                                        .closeAsync()
-                                                        .exceptionally(t -> {
-                                                            log.error("[{}] 
Close transactionBuffer failed", topic, t);
-                                                            return null;
-                                                        });
-                                                
persistentTopic.stopReplProducers()
-                                                        .whenCompleteAsync((v, 
exception) -> {
-                                                            
topics.remove(topic, topicFuture);
-                                                        }, executor());
+                                                executor().submit(() -> {
+                                                    
persistentTopic.close().whenComplete((ignore, ex) -> {
+                                                        if (ex != null) {
+                                                            log.warn("{} Get 
an error when closing topic.", topic, ex);

Review Comment:
   ```suggestion
                                                               log.warn("[{}] 
Get an error when closing topic.", topic, ex);
   ```



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