Skip to content

Commit

Permalink
chore(cmd/info): Fix printed spacing of summary. (hypermodeinc#1559)
Browse files Browse the repository at this point in the history
* chore(cmd/info): Fix printed spacing of summary.

Column-aligns the output for the Summary section:

Before:

    [Summary]
    Level 0 size:          0 B
    Level 1 size:       2.3 kB
    Total SST size:   2.3 kB
    Value log size:       20 B

After:

    [Summary]
    Level 0 size:          0 B
    Level 1 size:       2.3 kB
    Total SST size:     2.3 kB
    Value log size:       20 B

* fix: Set block cache and index cache sizes.

This fixes a panic when running badger info

    panic: BlockCacheSize should be set since compression/encryption are enabled
  • Loading branch information
danielmai authored Dec 4, 2020
1 parent 3782d88 commit 0f77c00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion badger/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func handleInfo(cmd *cobra.Command, args []string) error {
db, err := badger.Open(badger.DefaultOptions(sstDir).
WithValueDir(vlogDir).
WithReadOnly(opt.readOnly).
WithBlockCacheSize(100 << 20).
WithIndexCacheSize(200 << 20).
WithEncryptionKey([]byte(opt.encryptionKey)))
if err != nil {
return y.Wrap(err, "failed to open database")
Expand Down Expand Up @@ -434,7 +436,7 @@ func printInfo(dir, valueDir string) error {
totalSSTSize += sz
}

fmt.Printf("Total SST size: %8s\n", hbytes(totalSSTSize))
fmt.Printf("Total SST size: %10s\n", hbytes(totalSSTSize))
fmt.Printf("Value log size: %10s\n", hbytes(valueLogSize))
fmt.Println()
totalExtra := numExtra + numValueDirExtra
Expand Down

0 comments on commit 0f77c00

Please sign in to comment.