jerrypeng commented on a change in pull request #5322: Fix bk write failure 
part 2
URL: https://github.com/apache/pulsar/pull/5322#discussion_r332250591
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
 ##########
 @@ -342,15 +345,13 @@ public void addComplete(Position pos, Object ctx) {
 
     @Override
     public synchronized void addFailed(ManagedLedgerException exception, 
Object ctx) {
-
-        // fence topic when failed to write a message to BK
-        isFenced = true;
-
         if (exception instanceof ManagedLedgerFencedException) {
             // If the managed ledger has been fenced, we cannot continue using 
it. We need to close and reopen
             close();
         } else {
 
+            // fence topic when failed to write a message to BK
+            isFenced = true;
 
 Review comment:
   @rdhabalia I add this set here in a previous PR part of a line of PRs to fix 
problems in message deduplication (#5218). Setting "isFenced = true;" there 
when the exception is ManagedLedgerFencedException is inappropriate because of 
this check in close():
   
   
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L895
   
   There is already logic in the close() method to fence the topic

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to