Skip to content

Commit f4ef14f

Browse files
committed
tool: show compression stats in sstable properties
1 parent 222c46b commit f4ef14f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tool/sstable.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"context"
1010
"fmt"
1111
"io"
12+
"maps"
1213
"os"
1314
"slices"
1415
"strings"
@@ -318,15 +319,13 @@ func (s *sstableT) runProperties(cmd *cobra.Command, args []string) {
318319
fmt.Fprintf(tw, "merger\t%s\n", formatNull(props.MergerName))
319320
fmt.Fprintf(tw, "filter\t%s\n", formatNull(props.FilterPolicyName))
320321
fmt.Fprintf(tw, "compression\t%s\n", props.CompressionName)
322+
if props.CompressionStats != "" {
323+
fmt.Fprintf(tw, "compression stats\t%s\n", props.CompressionStats)
324+
}
321325
fmt.Fprintf(tw, "user properties\t\n")
322326
fmt.Fprintf(tw, " collectors\t%s\n", props.PropertyCollectorNames)
323327
// Read UserProperties directly from reader.
324-
keys := make([]string, 0, len(r.UserProperties))
325-
for key := range r.UserProperties {
326-
keys = append(keys, key)
327-
}
328-
slices.Sort(keys)
329-
for _, key := range keys {
328+
for _, key := range slices.Sorted(maps.Keys(r.UserProperties)) {
330329
fmt.Fprintf(tw, " %s\t%s\n", key, r.UserProperties[key])
331330
}
332331
_ = tw.Flush()

0 commit comments

Comments
 (0)