[19.03] vendor buildkit b26cff2413cc6a466f8739262efa13bd126f8fc7

full diff: https://github.com/moby/buildkit/compare/v0.6.4...b26cff2413cc6a466f8739262efa13bd126f8fc7

- solver: avoid looping over same keys in loadwithparents

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-04-06 19:06:25 +02:00
parent 1e1caccb13
commit 08a2fe0d56
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 8 additions and 4 deletions

View file

@ -26,7 +26,7 @@ github.com/imdario/mergo 7c29201646fa3de8506f70121347
golang.org/x/sync e225da77a7e68af35c70ccbf71af2b83e6acac3c
# buildkit
github.com/moby/buildkit ebcef1f69af0bbca077efa9a960a481e579a0e89 # v0.6.4
github.com/moby/buildkit b26cff2413cc6a466f8739262efa13bd126f8fc7 # v0.6.4 + aa7df97d7136e732561b59f87a38ad52d46d3b19
github.com/tonistiigi/fsutil 6c909ab392c173a4264ae1bfcbc0450b9aac0c7d
github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746
github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7

View file

@ -150,8 +150,12 @@ type LoadedResult struct {
CacheKey *CacheKey
}
func (c *cacheManager) filterResults(m map[string]Result, ck *CacheKey) (results []LoadedResult, err error) {
func (c *cacheManager) filterResults(m map[string]Result, ck *CacheKey, visited map[string]struct{}) (results []LoadedResult, err error) {
id := c.getID(ck)
if _, ok := visited[id]; ok {
return nil, nil
}
visited[id] = struct{}{}
if err := c.backend.WalkResults(id, func(cr CacheResult) error {
res, ok := m[id]
if ok {
@ -170,7 +174,7 @@ func (c *cacheManager) filterResults(m map[string]Result, ck *CacheKey) (results
}
for _, keys := range ck.Deps() {
for _, key := range keys {
res, err := c.filterResults(m, key.CacheKey.CacheKey)
res, err := c.filterResults(m, key.CacheKey.CacheKey, visited)
if err != nil {
for _, r := range results {
r.Result.Release(context.TODO())
@ -207,7 +211,7 @@ func (c *cacheManager) LoadWithParents(ctx context.Context, rec *CacheRecord) ([
return nil, err
}
results, err := c.filterResults(m, rec.key)
results, err := c.filterResults(m, rec.key, map[string]struct{}{})
if err != nil {
for _, r := range m {
r.Release(context.TODO())