Skip to content

Commit 3792669

Browse files
committed
*: prefix BlobFileIDs with a 'B'
Prefix printed BlobFileIDs with a B character to disambiguate.
1 parent 6715148 commit 3792669

File tree

20 files changed

+451
-438
lines changed

20 files changed

+451
-438
lines changed

internal/base/filenames.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ func PhysicalTableFileNum(f DiskFileNum) TableNum {
5252
type BlobFileID uint64
5353

5454
// String returns a string representation of the blob file ID.
55-
func (id BlobFileID) String() string { return fmt.Sprintf("%06d", id) }
55+
func (id BlobFileID) String() string { return fmt.Sprintf("B%06d", id) }
5656

5757
// SafeFormat implements redact.SafeFormatter.
5858
func (id BlobFileID) SafeFormat(w redact.SafePrinter, _ rune) {
59-
w.Printf("%06d", redact.SafeUint(id))
59+
w.Printf("B%06d", redact.SafeUint(id))
6060
}
6161

6262
// A DiskFileNum identifies a file or object with exists on disk.

internal/compact/testdata/iter

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,10 @@ next
11431143
next
11441144
next
11451145
----
1146-
a#9,SET:<blobref(000294, encodedHandle=020a, valLen=20)>
1147-
b#3,SET:<blobref(000294, encodedHandle=021e, valLen=5)>
1148-
c#8,SETWITHDEL:<blobref(000294, encodedHandle=0223, valLen=100)>
1149-
d#2,SET:<blobref(000294, encodedHandle=028701, valLen=4)>
1146+
a#9,SET:<blobref(B000294, encodedHandle=020a, valLen=20)>
1147+
b#3,SET:<blobref(B000294, encodedHandle=021e, valLen=5)>
1148+
c#8,SETWITHDEL:<blobref(B000294, encodedHandle=0223, valLen=100)>
1149+
d#2,SET:<blobref(B000294, encodedHandle=028701, valLen=4)>
11501150

11511151
# The iterator may need to fetch a blob value if it's an operand to the merge
11521152
# operator.
@@ -1162,6 +1162,6 @@ first
11621162
next
11631163
next
11641164
----
1165-
a#3,SET:<blobref(000294, encodedHandle=020a, valLen=20)>
1166-
b#9,SET:<fetched value from blobref(000294, encodedHandle=0223, valLen=100)>mergekeyvalue[base]
1165+
a#3,SET:<blobref(B000294, encodedHandle=020a, valLen=20)>
1166+
b#9,SET:<fetched value from blobref(B000294, encodedHandle=0223, valLen=100)>mergekeyvalue[base]
11671167
.

internal/manifest/blob_metadata.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ func ParseBlobFileMetadataDebug(s string) (_ BlobFileMetadata, err error) {
183183
}()
184184

185185
// Input format:
186-
// 000102 physical:{000000: size:[206536 (201KiB)], vals:[393256 (384KiB)]}
186+
// B000102 physical:{000000: size:[206536 (201KiB)], vals:[393256 (384KiB)]}
187187
p := strparse.MakeParser(debugParserSeparators, s)
188-
fileID := base.BlobFileID(p.Int())
188+
fileID := p.BlobFileID()
189189
p.Expect("physical")
190190
p.Expect(":")
191191
p.Expect("{")

internal/manifest/blob_metadata_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ func TestBlobFileMetadata_ParseRoundTrip(t *testing.T) {
5757
}{
5858
{
5959
name: "verbatim",
60-
input: "000002 physical:{000001 size:[903530 (882KB)] vals:[39531 (39KB)]}",
60+
input: "B000002 physical:{000001 size:[903530 (882KB)] vals:[39531 (39KB)]}",
6161
},
6262
{
6363
name: "whitespace is insignificant",
64-
input: "000002 physical : {000001 size : [ 903530 (882KB )] vals: [ 39531 ( 39KB ) ] }",
65-
output: "000002 physical:{000001 size:[903530 (882KB)] vals:[39531 (39KB)]}",
64+
input: "B000002 physical : {000001 size : [ 903530 (882KB )] vals: [ 39531 ( 39KB ) ] }",
65+
output: "B000002 physical:{000001 size:[903530 (882KB)] vals:[39531 (39KB)]}",
6666
},
6767
{
6868
name: "humanized sizes are optional",
69-
input: "000002 physical:{000001 size:[903530] vals:[39531]}",
70-
output: "000002 physical:{000001 size:[903530 (882KB)] vals:[39531 (39KB)]}",
69+
input: "B000002 physical:{000001 size:[903530] vals:[39531]}",
70+
output: "B000002 physical:{000001 size:[903530 (882KB)] vals:[39531 (39KB)]}",
7171
},
7272
}
7373
for _, tc := range testCases {

internal/manifest/table_metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ func ParseTableMetadataDebug(s string) (_ *TableMetadata, err error) {
803803
}
804804
p.Expect("(")
805805
var ref BlobReference
806-
ref.FileID = base.BlobFileID(p.Uint64())
806+
ref.FileID = p.BlobFileID()
807807
p.Expect(":")
808808
ref.ValueSize = p.Uint64()
809809
m.BlobReferences = append(m.BlobReferences, ref)

internal/manifest/table_metadata_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func TestTableMetadata_ParseRoundTrip(t *testing.T) {
119119
},
120120
{
121121
name: "blobrefs",
122-
input: "000196:[bar#0,SET-foo#0,SET] seqnums:[0-0] points:[bar#0,SET-foo#0,SET] blobrefs:[(000191: 2952), (000075: 108520); depth:2]",
122+
input: "000196:[bar#0,SET-foo#0,SET] seqnums:[0-0] points:[bar#0,SET-foo#0,SET] blobrefs:[(B000191: 2952), (B000075: 108520); depth:2]",
123123
},
124124
}
125125
for _, tc := range testCases {

internal/manifest/testdata/current_blob_file_set

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Files:{Count: 0, Size: 0, ValueSize: 0}, References:{ValueSize: 0, Count: 0}
1515
# A version edit that adds a new blob file records the new file and reference.
1616

1717
applyAndUpdateVersionEdit
18-
add-table: L3 000011:[d#1,SET-e#1,SET] blobrefs:[(000012: 25935); depth:1]
19-
add-blob-file: 000012 physical:{000012 size:[20535 (20KB)] vals:[25935 (25KB)]}
18+
add-table: L3 000011:[d#1,SET-e#1,SET] blobrefs:[(B000012: 25935); depth:1]
19+
add-blob-file: B000012 physical:{000012 size:[20535 (20KB)] vals:[25935 (25KB)]}
2020
----
2121
modified version edit:
22-
add-table: L3 000011:[d#1,SET-e#1,SET] seqnums:[0-0] points:[d#1,SET-e#1,SET] blobrefs:[(000012: 25935); depth:1]
23-
add-blob-file: 000012 physical:{000012 size:[20535 (20KB)] vals:[25935 (25KB)]}
22+
add-table: L3 000011:[d#1,SET-e#1,SET] seqnums:[0-0] points:[d#1,SET-e#1,SET] blobrefs:[(B000012: 25935); depth:1]
23+
add-blob-file: B000012 physical:{000012 size:[20535 (20KB)] vals:[25935 (25KB)]}
2424
current blob file set:
2525
Files:{Count: 1, Size: 20535, ValueSize: 25935}, References:{ValueSize: 25935, Count: 1}
2626

@@ -29,11 +29,11 @@ Files:{Count: 1, Size: 20535, ValueSize: 25935}, References:{ValueSize: 25935, C
2929

3030
applyAndUpdateVersionEdit
3131
del-table: L3 000011
32-
add-table: L4 000011:[d#1,SET-e#1,SET] blobrefs:[(000012: 25935); depth:1]
32+
add-table: L4 000011:[d#1,SET-e#1,SET] blobrefs:[(B000012: 25935); depth:1]
3333
----
3434
modified version edit:
3535
del-table: L3 000011
36-
add-table: L4 000011:[d#1,SET-e#1,SET] seqnums:[0-0] points:[d#1,SET-e#1,SET] blobrefs:[(000012: 25935); depth:1]
36+
add-table: L4 000011:[d#1,SET-e#1,SET] seqnums:[0-0] points:[d#1,SET-e#1,SET] blobrefs:[(B000012: 25935); depth:1]
3737
current blob file set:
3838
Files:{Count: 1, Size: 20535, ValueSize: 25935}, References:{ValueSize: 25935, Count: 1}
3939

@@ -42,13 +42,13 @@ Files:{Count: 1, Size: 20535, ValueSize: 25935}, References:{ValueSize: 25935, C
4242

4343
applyAndUpdateVersionEdit
4444
del-table: L4 000011
45-
add-table: L5 000013:[d#1,SET-e#1,SET] blobrefs:[(000012: 10); depth:2]
46-
add-table: L5 000014:[f#1,SET-g#1,SET] blobrefs:[(000012: 15935); depth:2]
45+
add-table: L5 000013:[d#1,SET-e#1,SET] blobrefs:[(B000012: 10); depth:2]
46+
add-table: L5 000014:[f#1,SET-g#1,SET] blobrefs:[(B000012: 15935); depth:2]
4747
----
4848
modified version edit:
4949
del-table: L4 000011
50-
add-table: L5 000013:[d#1,SET-e#1,SET] seqnums:[0-0] points:[d#1,SET-e#1,SET] blobrefs:[(000012: 10); depth:2]
51-
add-table: L5 000014:[f#1,SET-g#1,SET] seqnums:[0-0] points:[f#1,SET-g#1,SET] blobrefs:[(000012: 15935); depth:2]
50+
add-table: L5 000013:[d#1,SET-e#1,SET] seqnums:[0-0] points:[d#1,SET-e#1,SET] blobrefs:[(B000012: 10); depth:2]
51+
add-table: L5 000014:[f#1,SET-g#1,SET] seqnums:[0-0] points:[f#1,SET-g#1,SET] blobrefs:[(B000012: 15935); depth:2]
5252
current blob file set:
5353
Files:{Count: 1, Size: 20535, ValueSize: 25935}, References:{ValueSize: 15945, Count: 2}
5454

@@ -70,6 +70,6 @@ applyAndUpdateVersionEdit
7070
----
7171
modified version edit:
7272
del-table: L5 000013
73-
del-blob-file: 000012
73+
del-blob-file: B000012
7474
current blob file set:
7575
Files:{Count: 0, Size: 0, ValueSize: 0}, References:{ValueSize: 0, Count: 0}

internal/manifest/testdata/version_edit_apply

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -231,51 +231,51 @@ L2:
231231
# that is unknown.
232232

233233
apply v8
234-
add-table: L0 000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(000003: 25935); depth:1]
234+
add-table: L0 000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(B000003: 25935); depth:1]
235235
----
236-
error during Accumulate: blob file 000003 referenced by L0.000004 not found
236+
error during Accumulate: blob file B000003 referenced by L0.000004 not found
237237

238238
# Apply a version edit that introduces a new blob file and a corresponding table
239239
# that references its entirety.
240240

241241
apply v8 name=v9
242-
add-blob-file: 000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
243-
add-table: L0 000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(000003: 25935); depth:1]
242+
add-blob-file: B000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
243+
add-table: L0 000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(B000003: 25935); depth:1]
244244
----
245245
L0.0:
246-
000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(000003: 25935); depth:1]
246+
000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(B000003: 25935); depth:1]
247247
L1:
248248
000001:[a#2,SET-e#2,SET] seqnums:[0-0] points:[a#2,SET-e#2,SET]
249249
L2:
250250
000002:[c#1,SET-f#1,SET] seqnums:[0-0] points:[c#1,SET-f#1,SET]
251251
Blob files:
252-
000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
252+
B000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
253253

254254
# Try to add another table referencing the blob file. Since the file is not
255255
# added in the same version edit, and no referencing table is deleted in the
256256
# same version edit, accumulate will error.
257257

258258
apply v8
259-
add-table: L0 000005:[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET] blobrefs:[(000003: 205); depth:1]
259+
add-table: L0 000005:[a#10,SET-a#10,SET] seqnums:[10-10] points:[a#10,SET-a#10,SET] blobrefs:[(B000003: 205); depth:1]
260260
----
261-
error during Accumulate: blob file 000003 referenced by L0.000005 not found
261+
error during Accumulate: blob file B000003 referenced by L0.000005 not found
262262

263263
# We can add new tables referencing the blob file if we delete an existing table
264264
# with a reference to the file.
265265

266266
apply v9
267267
del-table: L0 000004
268268
del-table: L1 000001
269-
add-table: L1 000005:[a#9,SET-d#9,SET] seqnums:[0-9] points:[a#9,SET-d#9,SET] blobrefs:[(000003: 12205); depth:1]
270-
add-table: L1 000006:[e#2,SET-z#9,SET] seqnums:[0-9] points:[e#2,SET-z#9,SET] blobrefs:[(000003: 14192); depth:1]
269+
add-table: L1 000005:[a#9,SET-d#9,SET] seqnums:[0-9] points:[a#9,SET-d#9,SET] blobrefs:[(B000003: 12205); depth:1]
270+
add-table: L1 000006:[e#2,SET-z#9,SET] seqnums:[0-9] points:[e#2,SET-z#9,SET] blobrefs:[(B000003: 14192); depth:1]
271271
----
272272
L1:
273-
000005:[a#9,SET-d#9,SET] seqnums:[0-9] points:[a#9,SET-d#9,SET] blobrefs:[(000003: 12205); depth:1]
274-
000006:[e#2,SET-z#9,SET] seqnums:[0-9] points:[e#2,SET-z#9,SET] blobrefs:[(000003: 14192); depth:1]
273+
000005:[a#9,SET-d#9,SET] seqnums:[0-9] points:[a#9,SET-d#9,SET] blobrefs:[(B000003: 12205); depth:1]
274+
000006:[e#2,SET-z#9,SET] seqnums:[0-9] points:[e#2,SET-z#9,SET] blobrefs:[(B000003: 14192); depth:1]
275275
L2:
276276
000002:[c#1,SET-f#1,SET] seqnums:[0-0] points:[c#1,SET-f#1,SET]
277277
Blob files:
278-
000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
278+
B000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
279279

280280
# Repeat the above but this time applying the entire lifecycle of a blob file in
281281
# a single bulk version edit. This simulates a manifest replay during startup.
@@ -292,17 +292,17 @@ L2:
292292
000002:[c#1,SET-f#1,SET] seqnums:[0-0] points:[c#1,SET-f#1,SET]
293293

294294
apply v10
295-
add-blob-file: 000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
296-
add-table: L0 000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(000003: 25935); depth:1]
295+
add-blob-file: B000003 physical:{000003 size:[20535 (20KB)] vals:[25935 (25KB)]}
296+
add-table: L0 000004:[a#9,SET-z#9,DEL] seqnums:[9-9] points:[a#9,SET-z#9,DEL] blobrefs:[(B000003: 25935); depth:1]
297297
new version edit
298298
del-table: L0 000004
299299
del-table: L1 000001
300-
add-table: L1 000005:[a#9,SET-d#9,SET] seqnums:[0-9] points:[a#9,SET-d#9,SET] blobrefs:[(000003: 12205); depth:1]
301-
add-table: L1 000006:[e#2,SET-z#9,SET] seqnums:[0-9] points:[e#2,SET-z#9,SET] blobrefs:[(000003: 14192); depth:1]
300+
add-table: L1 000005:[a#9,SET-d#9,SET] seqnums:[0-9] points:[a#9,SET-d#9,SET] blobrefs:[(B000003: 12205); depth:1]
301+
add-table: L1 000006:[e#2,SET-z#9,SET] seqnums:[0-9] points:[e#2,SET-z#9,SET] blobrefs:[(B000003: 14192); depth:1]
302302
new version edit
303303
del-table: L1 000005
304304
del-table: L1 000006
305-
del-blob-file: 000003
305+
del-blob-file: B000003
306306
----
307307
L2:
308308
000002:[c#1,SET-f#1,SET] seqnums:[0-0] points:[c#1,SET-f#1,SET]

internal/manifest/testdata/version_edit_decode

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ f9a006 # . ValueSize = 102521
6868
log-num: 25
6969
next-file-num: 102
7070
last-seq-num: 2052
71-
add-blob-file: 000041 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
72-
del-blob-file: 000033
71+
add-blob-file: B000041 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
72+
del-blob-file: B000033
7373

7474
encode
75-
add-table: L6 000029:[bar#14,DEL-foo#13,SET] blobrefs:[(000041: 20952); depth:1]
76-
add-blob-file: 000943 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
77-
del-blob-file: 000033
75+
add-table: L6 000029:[bar#14,DEL-foo#13,SET] blobrefs:[(B000041: 20952); depth:1]
76+
add-blob-file: B000943 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
77+
del-blob-file: B000033
7878
----
7979
67061d000b626172000e0000000000000b666f6f010d0000000000000000
8080
45010129d8a301016baf0729d8a301f9a006006c21
81-
add-table: L6 000029:[bar#14,DEL-foo#13,SET] seqnums:[0-0] points:[bar#14,DEL-foo#13,SET] blobrefs:[(000041: 20952); depth:1]
82-
add-blob-file: 000943 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
83-
del-blob-file: 000033
81+
add-table: L6 000029:[bar#14,DEL-foo#13,SET] seqnums:[0-0] points:[bar#14,DEL-foo#13,SET] blobrefs:[(B000041: 20952); depth:1]
82+
add-blob-file: B000943 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
83+
del-blob-file: B000033
8484

8585
decode
8686
67061d000b626172000e0000000000000b666f6f010d0000000000000000
@@ -89,5 +89,5 @@ decode
8989
67061d000b626172000e0000000000000b666f6f010d0000000000000000
9090
45010129d8a301016baf0729d8a301f9a006006c21
9191
add-table: L6 000029:[bar#14,DEL-foo#13,SET]
92-
add-blob-file: 000943 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
93-
del-blob-file: 000033
92+
add-blob-file: B000943 physical:{000041 size:[20952 (20KB)] vals:[102521 (100KB)]}
93+
del-blob-file: B000033

internal/manifest/version_edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ func ParseVersionEditDebug(s string) (_ *VersionEdit, err error) {
697697
if ve.DeletedBlobFiles == nil {
698698
ve.DeletedBlobFiles = make(map[base.BlobFileID]*PhysicalBlobFile)
699699
}
700-
ve.DeletedBlobFiles[base.BlobFileID(p.Int())] = nil
700+
ve.DeletedBlobFiles[p.BlobFileID()] = nil
701701

702702
default:
703703
return nil, errors.Errorf("field %q not implemented", field)

0 commit comments

Comments
 (0)