Skip to content

Commit b157191

Browse files
Johan-Liebert1cgwalters
authored andcommitted
gc: Use trace logs
Use debug logs only for objects that are deleted. Use trace logs for objects that live Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent b9163a8 commit b157191

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

crates/composefs/src/repository.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
11911191
// Plain object references, add to live objects set
11921192
split_stream
11931193
.get_object_refs(|id| {
1194-
debug!(" with {id:?}");
1194+
trace!(" with {id:?}");
11951195
objects.insert(id.clone());
11961196
})
11971197
.context("Getting object references from stream")?;
@@ -1201,7 +1201,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
12011201
// In practice repository name is often table name prefixed with stream types (e.g. oci-config-<table name>)
12021202
// Here we always match objectID to be absolutely sure
12031203
for (stream_name_in_table, stream_object_id) in streams_to_walk {
1204-
debug!(
1204+
trace!(
12051205
" named reference stream {stream_name_in_table} lives, with {stream_object_id:?}"
12061206
);
12071207
objects.insert(stream_object_id.clone());
@@ -1315,13 +1315,13 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
13151315
.collect();
13161316

13171317
for ref image in root_images {
1318-
debug!("{image:?} lives as an image");
1318+
trace!("{image:?} lives as an image");
13191319
live_objects.insert(image.0.clone());
13201320
self.objects_for_image(&image.1)
13211321
.with_context(|| format!("Collecting objects for image {}", image.1))?
13221322
.iter()
13231323
.for_each(|id| {
1324-
debug!(" with {id:?}");
1324+
trace!(" with {id:?}");
13251325
live_objects.insert(id.clone());
13261326
});
13271327
}
@@ -1344,7 +1344,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
13441344

13451345
let mut walked_streams = HashSet::new();
13461346
for stream in root_streams {
1347-
debug!("{stream:?} lives as a stream");
1347+
trace!("{stream:?} lives as a stream");
13481348
live_objects.insert(stream.0.clone());
13491349
self.walk_streams(
13501350
&stream_name_map,
@@ -1381,8 +1381,12 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
13811381
}
13821382
result.objects_removed += 1;
13831383

1384+
debug!(
1385+
"{}: objects/{first_byte:02x}/{filename:?}",
1386+
if dry_run { "would remove" } else { "removing" },
1387+
);
1388+
13841389
if !dry_run {
1385-
debug!("removing: objects/{first_byte:02x}/{filename:?}");
13861390
unlinkat(&dirfd, filename, AtFlags::empty()).with_context(|| {
13871391
format!("Unlinking object {first_byte:02x}/{filename:?}")
13881392
})?;

0 commit comments

Comments
 (0)