Skip to content

Commit 75afc70

Browse files
committed
vfs: log GetDiskUsage calls in loggingFS
1 parent 459c8ae commit 75afc70

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

testdata/checkpoint

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ sync: db/marker.format-version.000015.028
100100
close: db/marker.format-version.000015.028
101101
remove: db/marker.format-version.000014.027
102102
sync: db
103+
get-disk-usage: db
103104

104105
batch db
105106
set a 1
@@ -118,6 +119,7 @@ create: db/000005.sst
118119
sync-data: db/000005.sst
119120
close: db/000005.sst
120121
sync: db
122+
get-disk-usage: db
121123
sync: db/MANIFEST-000001
122124

123125
batch db
@@ -137,6 +139,7 @@ create: db/000007.sst
137139
sync-data: db/000007.sst
138140
close: db/000007.sst
139141
sync: db
142+
get-disk-usage: db
140143
sync: db/MANIFEST-000001
141144

142145
batch db
@@ -280,6 +283,7 @@ create: db/000009.sst
280283
sync-data: db/000009.sst
281284
close: db/000009.sst
282285
sync: db
286+
get-disk-usage: db
283287
sync: db/MANIFEST-000001
284288
open: db/000005.sst (options: *vfs.randomReadsOption)
285289
read-at(610, 61): db/000005.sst
@@ -309,6 +313,7 @@ close: db/000009.sst
309313
sync-data: db/000010.sst
310314
close: db/000010.sst
311315
sync: db
316+
get-disk-usage: db
312317
sync: db/MANIFEST-000001
313318
close: db/000005.sst
314319
close: db/000007.sst
@@ -358,6 +363,7 @@ open: checkpoints/checkpoint1/OPTIONS-000002
358363
close: checkpoints/checkpoint1/OPTIONS-000002
359364
open: checkpoints/checkpoint1/000006.log (options: *vfs.sequentialReadsOption)
360365
close: checkpoints/checkpoint1/000006.log
366+
get-disk-usage: checkpoints/checkpoint1
361367

362368
scan checkpoints/checkpoint1
363369
----
@@ -425,6 +431,7 @@ open: checkpoints/checkpoint2/OPTIONS-000002
425431
close: checkpoints/checkpoint2/OPTIONS-000002
426432
open: checkpoints/checkpoint2/000006.log (options: *vfs.sequentialReadsOption)
427433
close: checkpoints/checkpoint2/000006.log
434+
get-disk-usage: checkpoints/checkpoint2
428435

429436
scan checkpoints/checkpoint2
430437
----
@@ -467,6 +474,7 @@ open: checkpoints/checkpoint3/OPTIONS-000002
467474
close: checkpoints/checkpoint3/OPTIONS-000002
468475
open: checkpoints/checkpoint3/000006.log (options: *vfs.sequentialReadsOption)
469476
close: checkpoints/checkpoint3/000006.log
477+
get-disk-usage: checkpoints/checkpoint3
470478

471479
scan checkpoints/checkpoint3
472480
----
@@ -610,6 +618,7 @@ open: checkpoints/checkpoint4/OPTIONS-000002
610618
close: checkpoints/checkpoint4/OPTIONS-000002
611619
open: checkpoints/checkpoint4/000008.log (options: *vfs.sequentialReadsOption)
612620
close: checkpoints/checkpoint4/000008.log
621+
get-disk-usage: checkpoints/checkpoint4
613622

614623
scan checkpoints/checkpoint4
615624
----
@@ -735,6 +744,7 @@ create: checkpoints/checkpoint5/000019.sst
735744
sync-data: checkpoints/checkpoint5/000019.sst
736745
close: checkpoints/checkpoint5/000019.sst
737746
sync: checkpoints/checkpoint5
747+
get-disk-usage: checkpoints/checkpoint5
738748
create: checkpoints/checkpoint5/MANIFEST-000020
739749
sync: checkpoints/checkpoint5/MANIFEST-000020
740750
create: checkpoints/checkpoint5/marker.manifest.000002.MANIFEST-000020
@@ -745,6 +755,7 @@ sync: checkpoints/checkpoint5
745755
remove: checkpoints/checkpoint5/000008.log
746756
create: checkpoints/checkpoint5/000021.log
747757
sync: checkpoints/checkpoint5
758+
get-disk-usage: checkpoints/checkpoint5
748759

749760
print-backing checkpoints/checkpoint5
750761
----
@@ -837,6 +848,7 @@ create: checkpoints/checkpoint6/000019.sst
837848
sync-data: checkpoints/checkpoint6/000019.sst
838849
close: checkpoints/checkpoint6/000019.sst
839850
sync: checkpoints/checkpoint6
851+
get-disk-usage: checkpoints/checkpoint6
840852
create: checkpoints/checkpoint6/MANIFEST-000020
841853
sync: checkpoints/checkpoint6/MANIFEST-000020
842854
create: checkpoints/checkpoint6/marker.manifest.000002.MANIFEST-000020
@@ -847,6 +859,7 @@ sync: checkpoints/checkpoint6
847859
remove: checkpoints/checkpoint6/000008.log
848860
create: checkpoints/checkpoint6/000021.log
849861
sync: checkpoints/checkpoint6
862+
get-disk-usage: checkpoints/checkpoint6
850863

851864
print-backing checkpoints/checkpoint6
852865
----
@@ -997,6 +1010,7 @@ sync: valsepdb/marker.format-version.000015.028
9971010
close: valsepdb/marker.format-version.000015.028
9981011
remove: valsepdb/marker.format-version.000014.027
9991012
sync: valsepdb
1013+
get-disk-usage: valsepdb
10001014

10011015
batch valsepdb
10021016
set a a
@@ -1023,6 +1037,7 @@ close: valsepdb/000006.blob
10231037
sync-data: valsepdb/000005.sst
10241038
close: valsepdb/000005.sst
10251039
sync: valsepdb
1040+
get-disk-usage: valsepdb
10261041
sync: valsepdb/MANIFEST-000001
10271042

10281043
# Perform a checkpoint. It should include the blob file.
@@ -1083,6 +1098,7 @@ open: checkpoints/checkpoint8/OPTIONS-000002
10831098
close: checkpoints/checkpoint8/OPTIONS-000002
10841099
open: checkpoints/checkpoint8/000004.log (options: *vfs.sequentialReadsOption)
10851100
close: checkpoints/checkpoint8/000004.log
1101+
get-disk-usage: checkpoints/checkpoint8
10861102

10871103
# Ensure that we can read values contained in the blob file.
10881104

@@ -1134,6 +1150,7 @@ close: valsepdb/000009.blob
11341150
sync-data: valsepdb/000008.sst
11351151
close: valsepdb/000008.sst
11361152
sync: valsepdb
1153+
get-disk-usage: valsepdb
11371154
sync: valsepdb/MANIFEST-000001
11381155

11391156

@@ -1195,6 +1212,7 @@ open: checkpoints/checkpoint9/OPTIONS-000002
11951212
close: checkpoints/checkpoint9/OPTIONS-000002
11961213
open: checkpoints/checkpoint9/000007.log (options: *vfs.sequentialReadsOption)
11971214
close: checkpoints/checkpoint9/000007.log
1215+
get-disk-usage: checkpoints/checkpoint9
11981216

11991217
scan checkpoints/checkpoint9
12001218
----

testdata/checkpoint_shared

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ sync: db/marker.format-version.000012.028
8585
close: db/marker.format-version.000012.028
8686
remove: db/marker.format-version.000011.027
8787
sync: db
88+
get-disk-usage: db
8889
create: db/REMOTE-OBJ-CATALOG-000001
8990
sync: db/REMOTE-OBJ-CATALOG-000001
9091
create: db/marker.remote-obj-catalog.000001.REMOTE-OBJ-CATALOG-000001
@@ -107,6 +108,7 @@ close: db/000003.log
107108
create: db/000004.log
108109
sync: db
109110
sync: db/REMOTE-OBJ-CATALOG-000001
111+
get-disk-usage: db
110112
sync: db/MANIFEST-000001
111113

112114
batch db
@@ -123,6 +125,7 @@ close: db/000004.log
123125
reuseForWrite: db/000003.log -> db/000006.log
124126
sync: db
125127
sync: db/REMOTE-OBJ-CATALOG-000001
128+
get-disk-usage: db
126129
sync: db/MANIFEST-000001
127130

128131
batch db
@@ -291,8 +294,10 @@ close: db/000006.log
291294
reuseForWrite: db/000004.log -> db/000008.log
292295
sync: db
293296
sync: db/REMOTE-OBJ-CATALOG-000001
297+
get-disk-usage: db
294298
sync: db/MANIFEST-000001
295299
sync: db/REMOTE-OBJ-CATALOG-000001
300+
get-disk-usage: db
296301
sync: db/MANIFEST-000001
297302

298303
batch db
@@ -339,6 +344,7 @@ open: checkpoints/checkpoint1/OPTIONS-000002
339344
close: checkpoints/checkpoint1/OPTIONS-000002
340345
open: checkpoints/checkpoint1/000006.log (options: *vfs.sequentialReadsOption)
341346
close: checkpoints/checkpoint1/000006.log
347+
get-disk-usage: checkpoints/checkpoint1
342348

343349
scan checkpoints/checkpoint1
344350
----
@@ -391,6 +397,7 @@ open: checkpoints/checkpoint2/OPTIONS-000002
391397
close: checkpoints/checkpoint2/OPTIONS-000002
392398
open: checkpoints/checkpoint2/000006.log (options: *vfs.sequentialReadsOption)
393399
close: checkpoints/checkpoint2/000006.log
400+
get-disk-usage: checkpoints/checkpoint2
394401

395402
scan checkpoints/checkpoint2
396403
----

testdata/cleaner

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ create: db/marker.format-version.000001.013
3737
sync: db/marker.format-version.000001.013
3838
close: db/marker.format-version.000001.013
3939
sync: db
40+
get-disk-usage: db
4041

4142
batch db
4243
set a 1
@@ -55,6 +56,7 @@ create: db/000005.sst
5556
sync-data: db/000005.sst
5657
close: db/000005.sst
5758
sync: db
59+
get-disk-usage: db
5860
sync: db/MANIFEST-000001
5961
mkdir-all: db_wal/archive 0755
6062
rename: db_wal/000003.log -> db_wal/archive/000003.log
@@ -74,6 +76,7 @@ create: db/000007.sst
7476
sync-data: db/000007.sst
7577
close: db/000007.sst
7678
sync: db
79+
get-disk-usage: db
7780
sync: db/MANIFEST-000001
7881
mkdir-all: db_wal/archive 0755
7982
rename: db_wal/000004.log -> db_wal/archive/000004.log
@@ -97,6 +100,7 @@ close: db/000007.sst
97100
sync-data: db/000008.sst
98101
close: db/000008.sst
99102
sync: db
103+
get-disk-usage: db
100104
sync: db/MANIFEST-000001
101105
close: db/000005.sst
102106
close: db/000007.sst
@@ -170,6 +174,7 @@ create: db1/marker.format-version.000001.013
170174
sync: db1/marker.format-version.000001.013
171175
close: db1/marker.format-version.000001.013
172176
sync: db1
177+
get-disk-usage: db1
173178

174179
batch db1
175180
set a 1
@@ -188,6 +193,7 @@ create: db1/000005.sst
188193
sync-data: db1/000005.sst
189194
close: db1/000005.sst
190195
sync: db1
196+
get-disk-usage: db1
191197
sync: db1/MANIFEST-000001
192198

193199
close db1
@@ -265,6 +271,7 @@ remove: db1/000456.sst
265271
remove: db1/000234.blob
266272
remove: db1/000345.blob
267273
sync: db1
274+
get-disk-usage: db1
268275
create: db1/MANIFEST-000459
269276
sync: db1/MANIFEST-000459
270277
create: db1/marker.manifest.000002.MANIFEST-000459
@@ -275,6 +282,7 @@ sync: db1
275282
remove: db1_wal/000004.log
276283
create: db1_wal/000460.log
277284
sync: db1_wal
285+
get-disk-usage: db1
278286

279287
list db1
280288
----

testdata/event_listener

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ close: db/marker.format-version.000015.028
123123
remove: db/marker.format-version.000014.027
124124
sync: db
125125
upgraded to format version: 028
126+
get-disk-usage: db
126127

127128
flush
128129
----
@@ -138,6 +139,7 @@ create: db/000005.sst
138139
sync-data: db/000005.sst
139140
close: db/000005.sst
140141
sync: db
142+
get-disk-usage: db
141143
create: db/MANIFEST-000006
142144
close: db/MANIFEST-000001
143145
sync: db/MANIFEST-000006
@@ -163,6 +165,7 @@ create: db/000008.sst
163165
sync-data: db/000008.sst
164166
close: db/000008.sst
165167
sync: db
168+
get-disk-usage: db
166169
create: db/MANIFEST-000009
167170
close: db/MANIFEST-000006
168171
sync: db/MANIFEST-000009
@@ -197,6 +200,7 @@ create: db/000010.sst
197200
sync-data: db/000010.sst
198201
close: db/000010.sst
199202
sync: db
203+
get-disk-usage: db
200204
create: db/MANIFEST-000011
201205
close: db/MANIFEST-000009
202206
sync: db/MANIFEST-000011
@@ -233,6 +237,7 @@ create: db/000013.sst
233237
sync-data: db/000013.sst
234238
close: db/000013.sst
235239
sync: db
240+
get-disk-usage: db
236241
create: db/MANIFEST-000014
237242
close: db/MANIFEST-000011
238243
sync: db/MANIFEST-000014
@@ -406,6 +411,7 @@ create: db/000022.sst
406411
sync-data: db/000022.sst
407412
close: db/000022.sst
408413
sync: db
414+
get-disk-usage: db
409415
sync: db/MANIFEST-000016
410416
[JOB 15] flushed 1 memtable (100B) to L0 [000022] (657B), in 1.0s (3.0s total), output rate 657B/s
411417
[JOB 16] flushing 2 ingested tables
@@ -422,6 +428,7 @@ sync: db
422428
remove: db/MANIFEST-000014
423429
[JOB 16] MANIFEST deleted 000014
424430
[JOB 17] flushing 1 memtable (100B) to L0
431+
get-disk-usage: db
425432
sync: db/MANIFEST-000023
426433
[JOB 17] flush error: pebble: empty table
427434

vfs/logging_fs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ func (fs loggingFS) RemoveAll(name string) error {
118118
return err
119119
}
120120

121+
func (fs loggingFS) GetDiskUsage(path string) (DiskUsage, error) {
122+
fs.logFn("get-disk-usage: %s", path)
123+
return fs.FS.GetDiskUsage(path)
124+
}
125+
121126
func (fs loggingFS) Unwrap() FS {
122127
return fs.FS
123128
}

0 commit comments

Comments
 (0)