You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/02/18 04:16:47 UTC

[GitHub] [bookkeeper] codelipenghui opened a new issue #2611: Read entry log metadata by log file name does not work.

codelipenghui opened a new issue #2611:
URL: https://github.com/apache/bookkeeper/issues/2611


   **BUG REPORT**
   
   ***Describe the bug***
   
   Use `bin/bookkeeper shell readlogmetadata 2.log` does not works but `bin/bookkeeper shell readlogmetadata 2` is works.
   
   ***To Reproduce***
   
   Steps to reproduce the behavior:
   1. Use bin/bookkeeper shell listfilesondisc -entrylog to get all entry logs
   2. Read log metadata of one entry log by the entry log file name
   3. See error
   
   ```
   Exception in thread "main" com.google.common.util.concurrent.UncheckedExecutionException: No file for log 0
   	at org.apache.bookkeeper.tools.cli.commands.bookie.ReadLogMetadataCommand.apply(ReadLogMetadataCommand.java:106)
   	at org.apache.bookkeeper.bookie.BookieShell$ReadLogMetadataCmd.runCmd(BookieShell.java:1048)
   	at org.apache.bookkeeper.bookie.BookieShell$MyCommand.runCmd(BookieShell.java:236)
   	at org.apache.bookkeeper.bookie.BookieShell.run(BookieShell.java:2235)
   	at org.apache.bookkeeper.bookie.BookieShell.main(BookieShell.java:2326)
   Caused by: java.io.FileNotFoundException: No file for log 0
   	at org.apache.bookkeeper.bookie.EntryLogger.findFile(EntryLogger.java:960)
   	at org.apache.bookkeeper.bookie.EntryLogger.getChannelForLogId(EntryLogger.java:895)
   	at org.apache.bookkeeper.bookie.EntryLogger.scanEntryLog(EntryLogger.java:976)
   	at org.apache.bookkeeper.bookie.EntryLogger.extractEntryLogMetadataByScanning(EntryLogger.java:1137)
   	at org.apache.bookkeeper.bookie.EntryLogger.getEntryLogMetadata(EntryLogger.java:1046)
   	at org.apache.bookkeeper.tools.cli.commands.bookie.ReadLogMetadataCommand.printEntryLogMetadata(ReadLogMetadataCommand.java:132)
   	at org.apache.bookkeeper.tools.cli.commands.bookie.ReadLogMetadataCommand.readLogMetadata(ReadLogMetadataCommand.java:125)
   	at org.apache.bookkeeper.tools.cli.commands.bookie.ReadLogMetadataCommand.apply(ReadLogMetadataCommand.java:104)
   	... 4 more
   ```
   
   ***Expected behavior***
   
   The readlogmetadata command should work with the log file name.
   
   


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



[GitHub] [bookkeeper] dlg99 commented on issue #2611: Read entry log metadata by log file name does not work.

Posted by GitBox <gi...@apache.org>.
dlg99 commented on issue #2611:
URL: https://github.com/apache/bookkeeper/issues/2611#issuecomment-781613850


   I think something like this should fix it:
   
   ```
   diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookie/ReadLogMetadataCommand.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookie/ReadLogMetadataCommand.java
   index ea63099ac..22904e40c 100644
   --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookie/ReadLogMetadataCommand.java
   +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/cli/commands/bookie/ReadLogMetadataCommand.java
   @@ -79,10 +79,10 @@ public class ReadLogMetadataCommand extends BookieCommand<ReadLogMetadataFlags>
        public static class ReadLogMetadataFlags extends CliFlags {
   
            @Parameter(names = { "-l", "--logid" }, description = "Entry log id")
   -        private long logId;
   +        private long logId = DEFAULT_LOGID;
   
            @Parameter(names = { "-f", "--filename" }, description = "Entry log filename")
   -        private String logFilename;
   +        private String logFilename = DEFAULT_FILENAME;
   
            @Parameter(names = { "-lf", "--ledgeridformatter" }, description = "Set ledger id formatter")
            private String ledgerIdFormatter = DEFAULT;
   ```
   
   please test/add unit tests ;)


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