You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/09/30 19:06:10 UTC

[GitHub] [bookkeeper] dlg99 opened a new pull request, #3513: LedgerOpenOp: Do not call blocking close() in the callback

dlg99 opened a new pull request, #3513:
URL: https://github.com/apache/bookkeeper/pull/3513

   Descriptions of the changes in this PR:
   
   ### Motivation
   
   https://github.com/apache/bookkeeper/pull/2794 introduced blocking call in the callback.
   I can't tell if it contributes to https://github.com/apache/bookkeeper/issues/3466 but it will lead to slow processing main worker pool under the conditions described in the issue (network retries, Zk session reconnects etc) 
   
   ### Changes
   
   Use async close.
   
   > ---
   > In order to uphold a high standard for quality for code contributions, Apache BookKeeper runs various precommit
   > checks for pull requests. A pull request can only be merged when it passes precommit checks.
   >
   > ---
   > Be sure to do all of the following to help us incorporate your contribution
   > quickly and easily:
   >
   > If this PR is a BookKeeper Proposal (BP):
   >
   > - [ ] Make sure the PR title is formatted like:
   >     `<BP-#>: Description of bookkeeper proposal`
   >     `e.g. BP-1: 64 bits ledger is support`
   > - [ ] Attach the master issue link in the description of this PR.
   > - [ ] Attach the google doc link if the BP is written in Google Doc.
   >
   > Otherwise:
   > 
   > - [ ] Make sure the PR title is formatted like:
   >     `<Issue #>: Description of pull request`
   >     `e.g. Issue 123: Description ...`
   > - [ ] Make sure tests pass via `mvn clean apache-rat:check install spotbugs:check`.
   > - [ ] Replace `<Issue #>` in the title with the actual Issue number.
   > 
   > ---
   


-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] eolivelli commented on pull request #3513: LedgerOpenOp: Do not call blocking close() in the callback

Posted by GitBox <gi...@apache.org>.
eolivelli commented on PR #3513:
URL: https://github.com/apache/bookkeeper/pull/3513#issuecomment-1263941198

   @RaulGracia can you run your test with this change?


-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] dlg99 commented on a diff in pull request #3513: LedgerOpenOp: Do not call blocking close() in the callback

Posted by GitBox <gi...@apache.org>.
dlg99 commented on code in PR #3513:
URL: https://github.com/apache/bookkeeper/pull/3513#discussion_r986070514


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -47,6 +48,7 @@
  * Encapsulates the ledger open operation.
  *
  */
+@Slf4j

Review Comment:
   we should a pass later and standardize this around lombok ;)



-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] StevenLuMT merged pull request #3513: LedgerOpenOp: Do not call blocking close() in the callback

Posted by GitBox <gi...@apache.org>.
StevenLuMT merged PR #3513:
URL: https://github.com/apache/bookkeeper/pull/3513


-- 
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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [bookkeeper] StevenLuMT commented on a diff in pull request #3513: LedgerOpenOp: Do not call blocking close() in the callback

Posted by GitBox <gi...@apache.org>.
StevenLuMT commented on code in PR #3513:
URL: https://github.com/apache/bookkeeper/pull/3513#discussion_r985339472


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -208,10 +204,13 @@ public void safeOperationComplete(int rc, Void result) {
                     if (rc == BKException.Code.OK) {
                         openComplete(BKException.Code.OK, lh);
                     } else if (rc == BKException.Code.UnauthorizedAccessException) {
-                        closeLedgerHandle();
-                        openComplete(BKException.Code.UnauthorizedAccessException, null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                log.error("Ledger {} close failed", ledgerId, ex);

Review Comment:
   change replace log to LOG
   `LOG.error("Ledger {} close failed", ledgerId, ex);`



##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -208,10 +204,13 @@ public void safeOperationComplete(int rc, Void result) {
                     if (rc == BKException.Code.OK) {
                         openComplete(BKException.Code.OK, lh);
                     } else if (rc == BKException.Code.UnauthorizedAccessException) {
-                        closeLedgerHandle();
-                        openComplete(BKException.Code.UnauthorizedAccessException, null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                log.error("Ledger {} close failed", ledgerId, ex);

Review Comment:
   change replace log to LOG ,like this:
   `LOG.error("Ledger {} close failed", ledgerId, ex);`



##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java:
##########
@@ -226,8 +225,12 @@ public String toString() {
                 public void readLastConfirmedComplete(int rc,
                         long lastConfirmed, Object ctx) {
                     if (rc != BKException.Code.OK) {
-                        closeLedgerHandle();
-                        openComplete(bk.getReturnRc(BKException.Code.ReadException), null);
+                        closeLedgerHandleAsync().whenComplete((r, ex) -> {
+                            if (ex != null) {
+                                log.error("Ledger {} close failed", ledgerId, ex);

Review Comment:
   change replace log to LOG ,like this:
   `LOG.error("Ledger {} close failed", ledgerId, 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: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org