From ba8be78054a25dc36ceafa4f1e9fe7f9b7e6c36b Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 6 Jun 2023 12:13:43 +0200 Subject: [PATCH] storage: use the TOC digest for partial layers Signed-off-by: Giuseppe Scrivano --- storage/storage_dest.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/storage/storage_dest.go b/storage/storage_dest.go index ee69693388..d9f77313b5 100644 --- a/storage/storage_dest.go +++ b/storage/storage_dest.go @@ -328,6 +328,14 @@ func (s *storageImageDestination) tryReusingBlobAsPending(digest digest.Digest, s.lock.Lock() defer s.lock.Unlock() + toc, err := chunked.GetTOCDigest(options.Annotations) + if err != nil { + return false, private.ReusedBlob{}, err + } + if toc != nil { + digest = *toc + } + if options.SrcRef != nil { // Check if we have the layer in the underlying additional layer store. aLayer, err := s.imageRef.transport.store.LookupAdditionalLayer(digest, options.SrcRef.String()) @@ -564,7 +572,10 @@ func (s *storageImageDestination) getDiffIDFromDigest(uncompressedDigest digest. s.lock.Lock() defer s.lock.Unlock() - d, found := s.diffOutputs[uncompressedDigest]; found { + if d, found := s.diffOutputs[uncompressedDigest]; found { + return d.TOCDigest, found + } + d, found := s.blobDiffIDs[uncompressedDigest] return d, found }