Merge pull request #7204 from cosmoer/fix-support-simultaneous-create-diff

This commit is contained in:
Fu Wei 2022-07-29 14:33:58 +08:00 committed by GitHub
commit 8a6ea4b21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ func CreateDiff(ctx context.Context, snapshotID string, sn snapshots.Snapshotter
return ocispec.Descriptor{}, err 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) lower, err := sn.View(ctx, lowerKey, info.Parent)
if err != nil { if err != nil {
return ocispec.Descriptor{}, err return ocispec.Descriptor{}, err
@ -58,7 +58,7 @@ func CreateDiff(ctx context.Context, snapshotID string, sn snapshots.Snapshotter
return ocispec.Descriptor{}, err return ocispec.Descriptor{}, err
} }
} else { } else {
upperKey := fmt.Sprintf("%s-view", snapshotID) upperKey := fmt.Sprintf("%s-view-%s", snapshotID, uniquePart())
upper, err = sn.View(ctx, upperKey, snapshotID) upper, err = sn.View(ctx, upperKey, snapshotID)
if err != nil { if err != nil {
return ocispec.Descriptor{}, err return ocispec.Descriptor{}, err