wuzhanpeng opened a new issue #2889:
URL: https://github.com/apache/bookkeeper/issues/2889


   **BUG REPORT**
   
   ***Describe the bug***
   
   Can not execute `ReadLogMetadata` with file name in bookkeeper shell.
   
   The parameter of `ReadLogMetadata` that cannot be parsed as numbers will 
eventually be converted to `0.log` due to `logId` in `ReadLogMetadataFlags` is 
never initialized.
   
   ***To Reproduce***
   
   Steps to reproduce the behavior:
   Execute command:
   `bin/bookkeeper shell readlogmetadata XXX.log`
   
   Then we can see:
   ```
   18:48:42.192 [main] INFO  
org.apache.bookkeeper.tools.cli.commands.bookie.ReadLogMetadataCommand - Print 
entryLogMetadata of entrylog 0 (0.log)
   18:48:42.295 [main] INFO  org.apache.bookkeeper.bookie.EntryLogger - Failed 
to get ledgers map index from: 0.log : No file for log 0
   18:48:42.298 [main] WARN  org.apache.bookkeeper.bookie.EntryLogger - Failed 
to get channel to scan entry log: 0.log
   :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:1136)
           at 
org.apache.bookkeeper.bookie.EntryLogger.getEntryLogMetadata(EntryLogger.java:1045)
           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***
   
   Ability to execute the command using log id or 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to