Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

repository2: get the correct layer index #188

Merged

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented Jul 28, 2016

In da56c93 we introduced an optimization to avoid going through all the
layers every time we need the index of a specific one.

However, this resulted in incorrect Image Manifests being generated.

In f8e82fa we attempted to fix this. We assumed that the mistake was
that the index we used was supposed to be reversed (from the end instead
of from the beginning of the layer list). This assumption was wrong. and
was probably motivated by the name of the map (reverseLayers).

The problem was that there can be several layers with the same BlobSum
(layerID) but different manifest and when we populated the map, we were
storing the last one for a given BlobSum. This is not what we were doing
previously, instead we were returning the first match.

Fix this by storing the first appearance of a BlobSum. Also, change the
name of reverseLayers to layersIndex.

  • Test

In da56c93 we introduced an optimization to avoid going through all the
layers every time we need the index of a specific one.

However, this resulted in incorrect Image Manifests being generated.

In f8e82fa we attempted to fix this. We assumed that the mistake was
that the index we used was supposed to be reversed (from the end instead
of from the beginning of the layer list). This assumption was wrong. and
was probably motivated by the name of the map (`reverseLayers`).

The problem was that there can be several layers with the same BlobSum
(layerID) but different manifest and when we populated the map, we were
storing the last one for a given BlobSum. This is not what we were doing
previously, instead we were returning the first match.

Fix this by storing the first appearance of a BlobSum. Also, change the
name of `reverseLayers` to `layersIndex`.
@iaguis
Copy link
Member Author

iaguis commented Aug 1, 2016

This is hard to test because it only happens with API v2.1 and not with v2.2 and I'm not really sure how to reproduce it. The only image that shows this behavior I know of is quay.io/stackanetes/stackanetes-memcached:barcelona

@iaguis
Copy link
Member Author

iaguis commented Aug 1, 2016

@dgonyeo can you have a look?

Maybe you can even think of a way to test this...

@cgonyeo
Copy link
Member

cgonyeo commented Aug 1, 2016

I've been wanting to add emulation of a v2.1 registry to the new golang tests I added (b173254), but this would take some time to implement, and I don't expect to have any spare time for at least a few weeks.

The changes would probably be:

  • adding support for generating v2.1 images
  • modifying the registry code to be able to serve v2.1 images
  • adding tests using this code to test the v2.1 codepath

@iaguis
Copy link
Member Author

iaguis commented Aug 2, 2016

I think I'll merge this without a test for now then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants