apache / apache/bookkeeper

Read entry log metadata by log file name does not work.

Open
#2,611 1 comment 0 reactions 0 assignees View on GitHub
type/bug
Dominant language
Java
Stars
2k
Forks
976
Avg merge
6d 15h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

Research direction

Start in ReadLogMetadataCommand.java, where the readlogmetadata argument is processed, then follow the call through BookieShell.java to EntryLogger.java. Reproduce the command with both 2.log and 2, and consider the issue done when metadata can be read by the full entry-log filename as well as the numeric log ID.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.