Skip to content

Commit

Permalink
add details for gc dry-run
Browse files Browse the repository at this point in the history
fixes 19040
Gives the make details for the dry-run

Signed-off-by: wang yan <[email protected]>
  • Loading branch information
wy65701436 committed Jul 28, 2023
1 parent 84a1317 commit cf2cdf9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/jobservice/job/impl/gc/garbage_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ func (gc *GarbageCollector) mark(ctx job.Context) error {
blobs = append(blobs, orphanBlobs...)
}
if len(blobs) == 0 {
if err := saveGCRes(ctx, int64(0), int64(0), int64(0)); err != nil {
gc.logger.Errorf("failed to save the garbage collection results, errMsg=%v", err)
}

Check warning on line 235 in src/jobservice/job/impl/gc/garbage_collection.go

View check run for this annotation

Codecov / codecov/patch

src/jobservice/job/impl/gc/garbage_collection.go#L233-L235

Added lines #L233 - L235 were not covered by tests
gc.logger.Info("no need to execute GC as there is no non referenced artifacts.")
return nil
}
Expand Down Expand Up @@ -269,6 +272,12 @@ func (gc *GarbageCollector) mark(ctx job.Context) error {
}
gc.logger.Infof("%d blobs and %d manifests eligible for deletion", blobCt, mfCt)
gc.logger.Infof("The GC could free up %d MB space, the size is a rough estimation.", makeSize/1024/1024)

if gc.dryRun {
if err := saveGCRes(ctx, makeSize, int64(blobCt), int64(mfCt)); err != nil {
gc.logger.Errorf("failed to save the garbage collection results, errMsg=%v", err)
}

Check warning on line 279 in src/jobservice/job/impl/gc/garbage_collection.go

View check run for this annotation

Codecov / codecov/patch

src/jobservice/job/impl/gc/garbage_collection.go#L277-L279

Added lines #L277 - L279 were not covered by tests
}
return nil
}

Expand Down

0 comments on commit cf2cdf9

Please sign in to comment.