wenbingshen commented on code in PR #3562:
URL: https://github.com/apache/bookkeeper/pull/3562#discussion_r1001329594


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -207,10 +207,19 @@ public void safeOperationComplete(int rc, Void result) {
                             if (ex != null) {
                                 LOG.error("Ledger {} close failed", ledgerId, 
ex);
                             }
-                            
openComplete(BKException.Code.UnauthorizedAccessException, null);
+                            openComplete(rc, null);
+                        });
+                    } else if (rc == BKException.Code.TimeoutException) {
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                LOG.error("Ledger {} read timeout", ledgerId, 
ex);
+                            }
+                            openComplete(rc, null);
                         });
                     } else {
-                        
openComplete(bk.getReturnRc(BKException.Code.LedgerRecoveryException), null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            
openComplete(bk.getReturnRc(BKException.Code.LedgerRecoveryException), null);
+                        });
                     }
                 }

Review Comment:
   also need log error:
   ```java
                               if (ex != null) {
                                   LOG.error("Ledger {} close failed", 
ledgerId, ex);
                               }
   ```



##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -207,10 +207,19 @@ public void safeOperationComplete(int rc, Void result) {
                             if (ex != null) {
                                 LOG.error("Ledger {} close failed", ledgerId, 
ex);
                             }
-                            
openComplete(BKException.Code.UnauthorizedAccessException, null);
+                            openComplete(rc, null);
+                        });
+                    } else if (rc == BKException.Code.TimeoutException) {
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                LOG.error("Ledger {} read timeout", ledgerId, 
ex);
+                            }
+                            openComplete(rc, null);
                         });

Review Comment:
   ```java
   LOG.error("Ledger {} read timeout", ledgerId, ex);
   ```
   should be replaced with the following:
   ```java
   LOG.error("Ledger {} close failed", ledgerId, ex);
   ```
   
   the `ex` is not the read timeout exception.
   



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