You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "gaozhangmin (via GitHub)" <gi...@apache.org> on 2023/05/08 07:47:51 UTC

[GitHub] [bookkeeper] gaozhangmin opened a new pull request, #3948: Optimize getEntryLogMetadata

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

   In the getEntryLogMetadata method, the FileNotFoundException exception is caught before the more general Exception. This modification ensures that if the log file is not found, there is no need to proceed with the extractEntryLogMetadataByScanning(entryLogId, throttler) method call.
   
   This enhancement improves the code's error handling by distinguishing between different exceptions that may occur during the retrieval of entry log metadata. It ensures that unnecessary operations, scanning the log, are skipped when the log file is not found.


-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1548800875

   rerun failure checks


-- 
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] hangc0276 commented on a diff in pull request #3948: Optimize getEntryLogMetadata

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#discussion_r1188052219


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,6 +1036,9 @@ public EntryLogMetadata getEntryLogMetadata(long entryLogId, AbstractLogCompacto
         // entry log
         try {
             return extractEntryLogMetadataFromIndex(entryLogId);
+        } catch (FileNotFoundException ex) {

Review Comment:
   This exception will be thrown by `extractEntryLogMetadataByScanning`, and I don't think it is necessary to catch the exception here.



-- 
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] zymap merged pull request #3948: Optimize getEntryLogMetadata

Posted by "zymap (via GitHub)" <gi...@apache.org>.
zymap merged PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948


-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1541784958

   rerun failure checks


-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1548889467

   rerun failure checks


-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1606421083

   rerun failure checks


-- 
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] horizonzy commented on a diff in pull request #3948: Optimize getEntryLogMetadata

Posted by "horizonzy (via GitHub)" <gi...@apache.org>.
horizonzy commented on code in PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#discussion_r1190134192


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,6 +1036,9 @@ public EntryLogMetadata getEntryLogMetadata(long entryLogId, AbstractLogCompacto
         // entry log
         try {
             return extractEntryLogMetadataFromIndex(entryLogId);
+        } catch (FileNotFoundException ex) {
+            LOG.warn("Cannot find entry log file {}.log", entryLogId);

Review Comment:
   The file entryLogId should be hex, we can get the log info by ex.getMessage()



##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,6 +1036,9 @@ public EntryLogMetadata getEntryLogMetadata(long entryLogId, AbstractLogCompacto
         // entry log
         try {
             return extractEntryLogMetadataFromIndex(entryLogId);
+        } catch (FileNotFoundException ex) {
+            LOG.warn("Cannot find entry log file {}.log", entryLogId);
+            throw new IOException(ex);

Review Comment:
   Why wrap the FileNotFoundExpcetion.



-- 
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] gaozhangmin commented on a diff in pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on code in PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#discussion_r1190716038


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,6 +1036,9 @@ public EntryLogMetadata getEntryLogMetadata(long entryLogId, AbstractLogCompacto
         // entry log
         try {
             return extractEntryLogMetadataFromIndex(entryLogId);
+        } catch (FileNotFoundException ex) {
+            LOG.warn("Cannot find entry log file {}.log", entryLogId);
+            throw new IOException(ex);

Review Comment:
   Please read the context above. @horizonzy 



-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1539290148

   rerun failure checks


-- 
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] gaozhangmin closed pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin closed pull request #3948: Optimize getEntryLogMetadata
URL: https://github.com/apache/bookkeeper/pull/3948


-- 
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] gaozhangmin commented on a diff in pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on code in PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#discussion_r1188195829


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,6 +1036,9 @@ public EntryLogMetadata getEntryLogMetadata(long entryLogId, AbstractLogCompacto
         // entry log
         try {
             return extractEntryLogMetadataFromIndex(entryLogId);
+        } catch (FileNotFoundException ex) {

Review Comment:
    If  `FileNotFoundException` is caught,  no need to proceed with the `extractEntryLogMetadataByScanning(entryLogId, throttler)` method call.  save unnecessary call.



-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1537994424

   rerun failure checks


-- 
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] horizonzy commented on a diff in pull request #3948: Optimize getEntryLogMetadata

Posted by "horizonzy (via GitHub)" <gi...@apache.org>.
horizonzy commented on code in PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#discussion_r1193069680


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,6 +1036,9 @@ public EntryLogMetadata getEntryLogMetadata(long entryLogId, AbstractLogCompacto
         // entry log
         try {
             return extractEntryLogMetadataFromIndex(entryLogId);
+        } catch (FileNotFoundException fne) {
+            LOG.warn("Cannot find entry log file {}.log : {}", entryLogId, fne.getMessage());

Review Comment:
   `{}.log` format should be hex. EntryLogId is decimal.



-- 
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] hangc0276 closed pull request #3948: Optimize getEntryLogMetadata

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 closed pull request #3948: Optimize getEntryLogMetadata
URL: https://github.com/apache/bookkeeper/pull/3948


-- 
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] gaozhangmin commented on pull request #3948: Optimize getEntryLogMetadata

Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #3948:
URL: https://github.com/apache/bookkeeper/pull/3948#issuecomment-1606522490

   rerun failure checks


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