Skip to content

Commit b4c3c46

Browse files
committed
fix: dedupe
Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>
1 parent a1ee011 commit b4c3c46

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pkg/storage/imagestore/imagestore.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,10 @@ func (is *ImageStore) DedupeBlob(src string, dstDigest godigest.Digest, dstRepo
11481148
retry:
11491149
is.log.Debug().Str("src", src).Str("dstDigest", dstDigest.String()).Str("dst", dst).Msg("dedupe begin")
11501150

1151+
if dst == "" {
1152+
return zerr.ErrEmptyValue
1153+
}
1154+
11511155
dstRecord, err := is.cache.GetBlob(dstDigest)
11521156
if err := inject.Error(err); err != nil && !errors.Is(err, zerr.ErrCacheMiss) {
11531157
is.log.Error().Err(err).Str("blobPath", dst).Str("component", "dedupe").Msg("failed to lookup blob record")
@@ -1181,13 +1185,17 @@ retry:
11811185

11821186
blobUploadRemoved = true
11831187

1184-
dstRecord = gdst
1188+
dstRecord = path.Join(constants.GlobalBlobsRepo, ispec.ImageBlobsDir, dstDigest.Algorithm().String(), dstDigest.Encoded())
1189+
if !is.cache.UsesRelativePaths() {
1190+
dstRecord = path.Join(is.rootDir, dstRecord)
1191+
}
11851192

11861193
is.log.Debug().Str("src", src).Str("dst", dst).Str("dstRecord", dstRecord).Str("component", "dedupe").Msg("rename")
11871194
}
11881195

11891196
// cache record exists, but due to GC and upgrades from older versions,
11901197
// disk content and cache records may go out of sync
1198+
is.log.Debug().Bool("relpath?", is.cache.UsesRelativePaths()).Msg("check this")
11911199
if is.cache.UsesRelativePaths() {
11921200
dstRecord = path.Join(is.rootDir, dstRecord)
11931201
}

0 commit comments

Comments
 (0)