From 9a633e5b3a1842158cbb3c0c2c7c92588ef7421d Mon Sep 17 00:00:00 2001 From: oxpa Date: Thu, 5 Sep 2024 14:13:22 +0100 Subject: [PATCH] Add debug --- experimental/manifest.go | 4 ++-- experimental/repository.go | 2 ++ experimental/tag.go | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/experimental/manifest.go b/experimental/manifest.go index 3a8aa38..344dbe6 100644 --- a/experimental/manifest.go +++ b/experimental/manifest.go @@ -69,7 +69,7 @@ func (m *manifestData) path() string { } func (m *manifestData) load(blobs blobsData) error { - logrus.Println("MANIFEST:", m.path(), ": loading...") + logrus.Infoln("MANIFEST:", m.path(), ": loading...") data, err := currentStorage.Read(m.path(), blobs.etag(m.digest)) if err != nil { @@ -88,7 +88,7 @@ func (m *manifestData) load(blobs blobsData) error { if err != nil { return err } - logrus.Println("MANIFEST: list", m.path(), " references ", digest) + logrus.Infoln("MANIFEST: list", m.path(), " references ", digest) m.manifests = append(m.manifests, digest) path := filepath.Join("blobs", digest.scopedPath(), "data") diff --git a/experimental/repository.go b/experimental/repository.go index 65b9576..a1d1ed4 100644 --- a/experimental/repository.go +++ b/experimental/repository.go @@ -59,6 +59,7 @@ func (r *repositoryData) markManifest(revision digest) error { r.lock.Lock() defer r.lock.Unlock() + logrus.Debugln("MANIFEST: marking ", revision) r.manifests[revision]++ return nil } @@ -182,6 +183,7 @@ func (r *repositoryData) mark(blobs blobsData) error { } func (r *repositoryData) sweep() error { + logrus.Debug("SWEEP: list of manifests", r.manifests) for name, t := range r.tags { err := t.sweep() if err != nil { diff --git a/experimental/tag.go b/experimental/tag.go index f31ae4c..820769b 100644 --- a/experimental/tag.go +++ b/experimental/tag.go @@ -45,6 +45,7 @@ func (t *tagData) mark(blobs blobsData) error { func (t *tagData) sweep() error { if !t.current.valid() { + logrus.Trace("TAG: deleting invalid current ", t.currentLinkPath()) err := deleteFile(t.currentLinkPath(), digestReferenceSize) if err != nil { return err @@ -55,11 +56,13 @@ func (t *tagData) sweep() error { if version == t.current { continue } + if t.repository.manifests[version] > 0 { continue } if *deleteOldTagVersions { + logrus.Trace("TAG: deleting old version", version) err := deleteFile(t.versionLinkPath(version), digestReferenceSize) if err != nil { return err