Skip to content

Commit

Permalink
*: extend DebugString to show backing file number
Browse files Browse the repository at this point in the history
  • Loading branch information
dt committed Feb 20, 2024
1 parent 31caf9f commit b24af45
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 120 deletions.
9 changes: 7 additions & 2 deletions internal/manifest/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,13 @@ func (m *FileMetadata) String() string {
// and overall bounds for the table.
func (m *FileMetadata) DebugString(format base.FormatKey, verbose bool) string {
var b bytes.Buffer
fmt.Fprintf(&b, "%s:[%s-%s]",
m.FileNum, m.Smallest.Pretty(format), m.Largest.Pretty(format))
if m.Virtual {
fmt.Fprintf(&b, "%s(%s):[%s-%s]",
m.FileNum, m.FileBacking.DiskFileNum, m.Smallest.Pretty(format), m.Largest.Pretty(format))
} else {
fmt.Fprintf(&b, "%s:[%s-%s]",
m.FileNum, m.Smallest.Pretty(format), m.Largest.Pretty(format))
}
if !verbose {
return b.String()
}
Expand Down
22 changes: 11 additions & 11 deletions testdata/checkpoint
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ ingest-and-excise db ext1 excise=c-d
lsm db
----
6:
000012:[a#0,SET-b#0,SET]
000013:[d#0,SET-g#0,SET]
000012(000010):[a#0,SET-b#0,SET]
000013(000010):[d#0,SET-g#0,SET]
000011:[i#20,SET-k#20,SET]

build db ext2 format=pebblev2
Expand All @@ -454,10 +454,10 @@ ingest-and-excise db ext2 excise=j-k
lsm db
----
6:
000012:[a#0,SET-b#0,SET]
000013:[d#0,SET-g#0,SET]
000015:[i#20,SET-i#20,SET]
000016:[k#20,SET-k#20,SET]
000012(000010):[a#0,SET-b#0,SET]
000013(000010):[d#0,SET-g#0,SET]
000015(000011):[i#20,SET-i#20,SET]
000016(000011):[k#20,SET-k#20,SET]
000014:[z#22,SET-z#22,SET]

# scan db so that it is known what to expect from the checkpoints.
Expand Down Expand Up @@ -670,9 +670,9 @@ lsm checkpoints/checkpoint5
0.0:
000017:[h#18,SET-h#18,SET]
6:
000013:[d#0,SET-g#0,SET]
000015:[i#20,SET-i#20,SET]
000016:[k#20,SET-k#20,SET]
000013(000010):[d#0,SET-g#0,SET]
000015(000011):[i#20,SET-i#20,SET]
000016(000011):[k#20,SET-k#20,SET]
000014:[z#22,SET-z#22,SET]

close checkpoints/checkpoint5
Expand Down Expand Up @@ -764,6 +764,6 @@ lsm checkpoints/checkpoint6
0.0:
000017:[h#18,SET-h#18,SET]
6:
000015:[i#20,SET-i#20,SET]
000016:[k#20,SET-k#20,SET]
000015(000011):[i#20,SET-i#20,SET]
000016(000011):[k#20,SET-k#20,SET]
000014:[z#22,SET-z#22,SET]
4 changes: 2 additions & 2 deletions testdata/concurrent_excise
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ ok
lsm
----
6:
000010:[d#14,DELSIZED-d#14,DEL]
000011:[f#11,SET-f#11,SET]
000010(000010):[d#14,DELSIZED-d#14,DEL]
000011(000005):[f#11,SET-f#11,SET]

compact a-z
----
Expand Down
72 changes: 36 additions & 36 deletions testdata/excise
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,42 @@ excise c k
would excise 2 files, use ingest-and-excise to excise.
deleted: L0 000006
deleted: L6 000004
added: L6 000007:[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]
added: L6 000008:[l#10,SET-l#10,SET] seqnums:[10-10] points:[l#10,SET-l#10,SET]
added: L6 000007(000004):[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]
added: L6 000008(000004):[l#10,SET-l#10,SET] seqnums:[10-10] points:[l#10,SET-l#10,SET]


excise a e
----
would excise 2 files, use ingest-and-excise to excise.
deleted: L0 000006
deleted: L6 000004
added: L0 000009:[f#12,SET-f#12,SET] seqnums:[11-12] points:[f#12,SET-f#12,SET]
added: L6 000010:[l#10,SET-l#10,SET] seqnums:[10-10] points:[l#10,SET-l#10,SET]
added: L0 000009(000006):[f#12,SET-f#12,SET] seqnums:[11-12] points:[f#12,SET-f#12,SET]
added: L6 000010(000004):[l#10,SET-l#10,SET] seqnums:[10-10] points:[l#10,SET-l#10,SET]

excise e z
----
would excise 2 files, use ingest-and-excise to excise.
deleted: L0 000006
deleted: L6 000004
added: L0 000011:[d#11,SET-d#11,SET] seqnums:[11-12] points:[d#11,SET-d#11,SET]
added: L6 000012:[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]
added: L0 000011(000006):[d#11,SET-d#11,SET] seqnums:[11-12] points:[d#11,SET-d#11,SET]
added: L6 000012(000004):[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]

excise f l
----
would excise 2 files, use ingest-and-excise to excise.
deleted: L0 000006
deleted: L6 000004
added: L0 000013:[d#11,SET-d#11,SET] seqnums:[11-12] points:[d#11,SET-d#11,SET]
added: L6 000014:[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]
added: L6 000015:[l#10,SET-l#10,SET] seqnums:[10-10] points:[l#10,SET-l#10,SET]
added: L0 000013(000006):[d#11,SET-d#11,SET] seqnums:[11-12] points:[d#11,SET-d#11,SET]
added: L6 000014(000004):[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]
added: L6 000015(000004):[l#10,SET-l#10,SET] seqnums:[10-10] points:[l#10,SET-l#10,SET]

excise f ll
----
would excise 2 files, use ingest-and-excise to excise.
deleted: L0 000006
deleted: L6 000004
added: L0 000016:[d#11,SET-d#11,SET] seqnums:[11-12] points:[d#11,SET-d#11,SET]
added: L6 000017:[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]
added: L0 000016(000006):[d#11,SET-d#11,SET] seqnums:[11-12] points:[d#11,SET-d#11,SET]
added: L6 000017(000004):[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET]

excise p q
----
Expand Down Expand Up @@ -105,9 +105,9 @@ ingest-and-excise ext1 excise=c-k
lsm
----
6:
000019:[a#10,SET-a#10,SET]
000019(000004):[a#10,SET-a#10,SET]
000018:[d#14,SET-e#14,SET]
000020:[l#10,SET-l#10,SET]
000020(000004):[l#10,SET-l#10,SET]

iter
first
Expand Down Expand Up @@ -154,14 +154,14 @@ excise f g
----
would excise 1 files, use ingest-and-excise to excise.
deleted: L0 000005
added: L0 000006:[b#11,SET-b#11,SET] seqnums:[11-11] points:[b#11,SET-b#11,SET]
added: L0 000007:[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]
added: L0 000006(000005):[b#11,SET-b#11,SET] seqnums:[11-11] points:[b#11,SET-b#11,SET]
added: L0 000007(000005):[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]

excise b c
----
would excise 1 files, use ingest-and-excise to excise.
deleted: L0 000005
added: L0 000008:[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]
added: L0 000008(000005):[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]

excise i j
----
Expand All @@ -175,9 +175,9 @@ excise c d
would excise 2 files, use ingest-and-excise to excise.
deleted: L0 000005
deleted: L6 000004
added: L0 000009:[b#11,SET-b#11,SET] seqnums:[11-11] points:[b#11,SET-b#11,SET]
added: L0 000010:[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]
added: L6 000011:[d#10,RANGEKEYSET-f#inf,RANGEKEYSET] seqnums:[10-10] ranges:[d#10,RANGEKEYSET-f#inf,RANGEKEYSET]
added: L0 000009(000005):[b#11,SET-b#11,SET] seqnums:[11-11] points:[b#11,SET-b#11,SET]
added: L0 000010(000005):[g#11,RANGEDEL-i#inf,RANGEDEL] seqnums:[11-11] points:[g#11,RANGEDEL-i#inf,RANGEDEL]
added: L6 000011(000004):[d#10,RANGEKEYSET-f#inf,RANGEKEYSET] seqnums:[10-10] ranges:[d#10,RANGEKEYSET-f#inf,RANGEKEYSET]

reset
----
Expand Down Expand Up @@ -208,8 +208,8 @@ ingest-and-excise ext2 excise=b-c
lsm
----
0.0:
000007:[a#10,SET-a#10,SET]
000008:[d#12,SET-ee#inf,RANGEKEYSET]
000007(000005):[a#10,SET-a#10,SET]
000008(000005):[d#12,SET-ee#inf,RANGEKEYSET]
6:
000006:[z#15,SET-z#15,SET]

Expand Down Expand Up @@ -248,8 +248,8 @@ ingest-and-excise ext2 excise=d-e
lsm
----
0.0:
000007:[a#10,SET-c#12,SET]
000008:[e#14,SET-j#19,SET]
000007(000005):[a#10,SET-c#12,SET]
000008(000005):[e#14,SET-j#19,SET]
6:
000006:[z#21,SET-z#21,SET]

Expand All @@ -264,9 +264,9 @@ ingest-and-excise ext3 excise=g-h
lsm
----
0.0:
000007:[a#10,SET-c#12,SET]
000010:[e#14,SET-f#15,SET]
000011:[h#17,SET-j#19,SET]
000007(000005):[a#10,SET-c#12,SET]
000010(000005):[e#14,SET-f#15,SET]
000011(000005):[h#17,SET-j#19,SET]
6:
000006:[z#21,SET-z#21,SET]
000009:[zz#23,SET-zz#23,SET]
Expand All @@ -283,9 +283,9 @@ reopen
lsm
----
0.0:
000007:[a#10,SET-c#12,SET]
000010:[e#14,SET-f#15,SET]
000011:[h#17,SET-j#19,SET]
000007(000005):[a#10,SET-c#12,SET]
000010(000005):[e#14,SET-f#15,SET]
000011(000005):[h#17,SET-j#19,SET]
6:
000006:[z#21,SET-z#21,SET]
000009:[zz#23,SET-zz#23,SET]
Expand Down Expand Up @@ -324,7 +324,7 @@ ingest-and-excise ext2 excise=d-f
lsm
----
0.0:
000007:[a#10,SET-c#12,SET]
000007(000005):[a#10,SET-c#12,SET]
6:
000006:[z#16,SET-z#16,SET]

Expand All @@ -334,7 +334,7 @@ reopen
lsm
----
0.0:
000007:[a#10,SET-c#12,SET]
000007(000005):[a#10,SET-c#12,SET]
6:
000006:[z#16,SET-z#16,SET]

Expand Down Expand Up @@ -401,11 +401,11 @@ ingest-and-excise ext3 excise=bd-cc
lsm
----
0.0:
000011:[cc#17,RANGEKEYSET-f#17,MERGE]
000011(000009):[cc#17,RANGEKEYSET-f#17,MERGE]
000010:[z#19,SET-z#19,SET]
6:
000012:[a@3#0,SET-bbsomethinglong@4#0,MERGE]
000013:[d@6#0,MERGE-z#0,MERGE]
000012(000008):[a@3#0,SET-bbsomethinglong@4#0,MERGE]
000013(000008):[d@6#0,MERGE-z#0,MERGE]

iter range-key-masking=@10
first
Expand Down Expand Up @@ -509,9 +509,9 @@ lsm
0.0:
000012:[x#14,SET-x#14,SET]
6:
000013:[a#0,SET-b#0,SET]
000013(000009):[a#0,SET-b#0,SET]
000010:[c#17,SET-c#17,SET]
000014:[d@6#15,DEL-d@6#0,SET]
000014(000009):[d@6#15,DEL-d@6#0,SET]

iter lower=c upper=e
last
Expand Down
40 changes: 20 additions & 20 deletions testdata/ingest
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,9 @@ ingest ext11
lsm
----
6:
000006:[a#10,SET-a#10,SET]
000006(000004):[a#10,SET-a#10,SET]
000005:[b#11,SET-d#11,SET]
000007:[e#10,SET-e#10,SET]
000007(000004):[e#10,SET-e#10,SET]

iter
first
Expand Down Expand Up @@ -969,9 +969,9 @@ lsm
0.0:
000008:[c#12,SET-e#12,SET]
6:
000006:[a#10,SET-a#10,SET]
000006(000004):[a#10,SET-a#10,SET]
000005:[b#11,SET-d#11,SET]
000007:[e#10,SET-e#10,SET]
000007(000004):[e#10,SET-e#10,SET]

# The below ingestion should fall through one existing file and split another
# file.
Expand All @@ -989,11 +989,11 @@ lsm
0.0:
000008:[c#12,SET-e#12,SET]
6:
000006:[a#10,SET-a#10,SET]
000010:[b#11,SET-b#11,SET]
000006(000004):[a#10,SET-a#10,SET]
000010(000005):[b#11,SET-b#11,SET]
000009:[cc#13,SET-ccc#13,SET]
000011:[d#11,SET-d#11,SET]
000007:[e#10,SET-e#10,SET]
000011(000005):[d#11,SET-d#11,SET]
000007(000004):[e#10,SET-e#10,SET]

iter
seek-ge c
Expand Down Expand Up @@ -1025,11 +1025,11 @@ lsm
0.0:
000008:[c#12,SET-e#12,SET]
6:
000006:[a#10,SET-a#10,SET]
000010:[b#11,SET-b#11,SET]
000006(000004):[a#10,SET-a#10,SET]
000010(000005):[b#11,SET-b#11,SET]
000009:[cc#13,SET-ccc#13,SET]
000011:[d#11,SET-d#11,SET]
000007:[e#10,SET-e#10,SET]
000011(000005):[d#11,SET-d#11,SET]
000007(000004):[e#10,SET-e#10,SET]

iter
seek-lt d
Expand Down Expand Up @@ -1083,10 +1083,10 @@ ingest ext11 ext12
lsm
----
6:
000007:[a#10,SET-a#10,SET]
000007(000004):[a#10,SET-a#10,SET]
000005:[b#11,SET-c#11,SET]
000006:[cc#12,SET-d#12,SET]
000008:[e#10,SET-g#10,SET]
000008(000004):[e#10,SET-g#10,SET]

# A virtual sstable produced from an ingest split can be ingest split again.

Expand All @@ -1101,12 +1101,12 @@ ingest ext13
lsm
----
6:
000007:[a#10,SET-a#10,SET]
000007(000004):[a#10,SET-a#10,SET]
000005:[b#11,SET-c#11,SET]
000006:[cc#12,SET-d#12,SET]
000010:[e#10,SET-e#10,SET]
000010(000004):[e#10,SET-e#10,SET]
000009:[ee#13,SET-f#13,SET]
000011:[g#10,SET-g#10,SET]
000011(000004):[g#10,SET-g#10,SET]

reset enable-split
----
Expand Down Expand Up @@ -1149,12 +1149,12 @@ ingest ext11 ext12 ext13
lsm
----
6:
000008:[a#10,SET-a#10,SET]
000008(000004):[a#10,SET-a#10,SET]
000005:[b#11,SET-c#11,SET]
000006:[cc#12,SET-d#12,SET]
000010:[e#10,SET-e#10,SET]
000010(000004):[e#10,SET-e#10,SET]
000007:[ee#13,SET-f#13,SET]
000011:[g#10,SET-g#10,SET]
000011(000004):[g#10,SET-g#10,SET]

iter
first
Expand Down
Loading

0 comments on commit b24af45

Please sign in to comment.