From 344431cdd48ec19b73fdc5d36f056eb7bee5154b Mon Sep 17 00:00:00 2001 From: cosmoer Date: Sat, 23 Jul 2022 23:57:53 +0800 Subject: [PATCH] fix: support simultaneous create diff for same parent snapshot Signed-off-by: Qian Zhang --- rootfs/diff.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/diff.go b/rootfs/diff.go index f396c73ab..226cebccf 100644 --- a/rootfs/diff.go +++ b/rootfs/diff.go @@ -44,7 +44,7 @@ func CreateDiff(ctx context.Context, snapshotID string, sn snapshots.Snapshotter return ocispec.Descriptor{}, err } - lowerKey := fmt.Sprintf("%s-parent-view", info.Parent) + lowerKey := fmt.Sprintf("%s-parent-view-%s", info.Parent, uniquePart()) lower, err := sn.View(ctx, lowerKey, info.Parent) if err != nil { return ocispec.Descriptor{}, err @@ -58,7 +58,7 @@ func CreateDiff(ctx context.Context, snapshotID string, sn snapshots.Snapshotter return ocispec.Descriptor{}, err } } else { - upperKey := fmt.Sprintf("%s-view", snapshotID) + upperKey := fmt.Sprintf("%s-view-%s", snapshotID, uniquePart()) upper, err = sn.View(ctx, upperKey, snapshotID) if err != nil { return ocispec.Descriptor{}, err