Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool: show LSM viewer URL in db lsm command #3609

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions tool/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type dbT struct {
ioSizes string
verbose bool
bypassPrompt bool
lsmURL bool
}

func newDB(
Expand Down Expand Up @@ -210,6 +211,9 @@ specified database.
&d.fmtValue, "value", "value formatter")
}

d.LSM.Flags().BoolVar(
&d.lsmURL, "url", false, "generate LSM viewer URL")

d.Space.Flags().Var(
&d.start, "start", "start key for the range")
d.Space.Flags().Var(
Expand Down Expand Up @@ -445,6 +449,9 @@ func (d *dbT) runLSM(cmd *cobra.Command, args []string) {
defer d.closeDB(stderr, db)

fmt.Fprintf(stdout, "%s", db.Metrics())
if d.lsmURL {
fmt.Fprintf(stdout, "\nLSM viewer: %s\n", db.LSMViewURL())
}
}

func (d *dbT) runScan(cmd *cobra.Command, args []string) {
Expand Down
37 changes: 37 additions & 0 deletions tool/testdata/db_lsm
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,40 @@ Snapshots: 0 earliest seq num: 0
Table iters: 0
Filter utility: 0.0%
Ingestions: 0 as flushable: 0 (0B in 0 tables)

db lsm --url
../testdata/db-stage-4
----
----
| | | | ingested | moved | written | | amp
level | tables size val-bl vtables | score | in | tables size | tables size | tables size | read | r w
------+-----------------------------+-------+-------+--------------+--------------+--------------+-------+---------
0 | 1 709B 0B 0 | 0.50 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
1 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
2 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
3 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
4 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
5 | 0 0B 0B 0 | 0.00 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
6 | 0 0B 0B 0 | - | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
total | 1 709B 0B 0 | - | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0.0
-------------------------------------------------------------------------------------------------------------------
WAL: 0 files (0B) in: 0B written: 0B (0% overhead)
Flushes: 0
Compactions: 0 estimated debt: 0B in progress: 0 (0B)
default: 0 delete: 0 elision: 0 move: 0 read: 0 rewrite: 0 copy: 0 multi-level: 0
MemTables: 1 (256KB) zombie: 0 (0B)
Zombie tables: 0 (0B, local: 0B)
Backing tables: 0 (0B)
Virtual tables: 0 (0B)
Local tables size: 709B
Block cache: 0 entries (0B) hit rate: 0.0%
Table cache: 0 entries (0B) hit rate: 0.0%
Secondary cache: 0 entries (0B) hit rate: 0.0%
Snapshots: 0 earliest seq num: 0
Table iters: 0
Filter utility: 0.0%
Ingestions: 0 as flushable: 0 (0B in 0 tables)

LSM viewer: https://raduberinde.github.io/lsmview/decode.html#eJyE0EFLw0AQBeC7v2J4uU5lN42W7lHsrTe9SSgTOi2hm13NRqGV_HdJCaUWMXvaxzfMwPuG1y_1Ce5t_G6CNAqHtbk3YHRSeR1ZKvVwKMBI9UnhFmbJSI14r6nbHPQIZxhe2v0lW8ZWO6nPJ2CGVziqpM1swc-rNc1oF2Nm5_yyeh0XO1qY5dMQ9CN8NsmRzWlGdjj8HuvQpf820JWN8ZTZ_KI3wyFSK2GvtB1qKPuy59sm7HUPf3g-4fMJLyb8YcIff3vJOOjx3HclLRi7GFH2dz8BAAD__2dulBM=
----
----