Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-05-06 17:46:32 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-05-06 17:46:32 +0300
commit70fb398408f31a9e5c0d21a4ecf08cdd4414b8e1 (patch)
treebef29d21319ac71604576a301bbb9208d1d10391
parent664e472393e6b687777ef42a5a34ffd02e04ed08 (diff)
Use simpler data structure for cat-file cache
-rw-r--r--NOTICE193
-rw-r--r--changelogs/unreleased/jv-sketch-cache-data-structure.yml5
-rw-r--r--internal/git/catfile/batch.go31
-rw-r--r--internal/git/catfile/batch_cache.go201
-rw-r--r--internal/git/catfile/batch_cache_test.go185
-rw-r--r--internal/git/catfile/catfile.go97
-rw-r--r--vendor/github.com/golang/groupcache/LICENSE191
-rw-r--r--vendor/github.com/golang/groupcache/lru/lru.go133
-rw-r--r--vendor/vendor.json6
9 files changed, 330 insertions, 712 deletions
diff --git a/NOTICE b/NOTICE
index 6bd052db3..bb2f54e72 100644
--- a/NOTICE
+++ b/NOTICE
@@ -262,199 +262,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LICENSE - gitlab.com/gitlab-org/gitaly/vendor/github.com/golang/groupcache
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LICENSE - gitlab.com/gitlab-org/gitaly/vendor/github.com/golang/protobuf
Copyright 2010 The Go Authors. All rights reserved.
diff --git a/changelogs/unreleased/jv-sketch-cache-data-structure.yml b/changelogs/unreleased/jv-sketch-cache-data-structure.yml
new file mode 100644
index 000000000..83fc834f7
--- /dev/null
+++ b/changelogs/unreleased/jv-sketch-cache-data-structure.yml
@@ -0,0 +1,5 @@
+---
+title: Use simpler data structure for cat-file cache
+merge_request: 1233
+author:
+type: other
diff --git a/internal/git/catfile/batch.go b/internal/git/catfile/batch.go
index ef39da7bc..4c7f68193 100644
--- a/internal/git/catfile/batch.go
+++ b/internal/git/catfile/batch.go
@@ -12,7 +12,7 @@ import (
)
// batch encapsulates a 'git cat-file --batch' process
-type batch struct {
+type batchProcess struct {
r *bufio.Reader
w io.WriteCloser
@@ -30,8 +30,8 @@ type batch struct {
sync.Mutex
}
-func newBatch(ctx context.Context, repoPath string, env []string) (*batch, error) {
- b := &batch{}
+func newBatchProcess(ctx context.Context, repoPath string, env []string) (*batchProcess, error) {
+ b := &batchProcess{}
var stdinReader io.Reader
stdinReader, b.w = io.Pipe()
@@ -54,7 +54,7 @@ func newBatch(ctx context.Context, repoPath string, env []string) (*batch, error
return b, nil
}
-func (b *batch) reader(revspec string, expectedType string) (io.Reader, error) {
+func (b *batchProcess) reader(revspec string, expectedType string) (io.Reader, error) {
b.Lock()
defer b.Unlock()
@@ -93,28 +93,35 @@ func (b *batch) reader(revspec string, expectedType string) (io.Reader, error) {
}
return &batchReader{
- batch: b,
- r: io.LimitReader(b.r, oi.Size),
+ batchProcess: b,
+ r: io.LimitReader(b.r, oi.Size),
}, nil
}
-func (b *batch) consume(nBytes int) {
- b.Lock()
- defer b.Unlock()
-
+func (b *batchProcess) consume(nBytes int) {
b.n -= int64(nBytes)
if b.n < 1 {
panic("too many bytes read from batch")
}
}
+func (b *batchProcess) hasUnreadData() bool {
+ b.Lock()
+ defer b.Unlock()
+
+ return b.n > 1
+}
+
type batchReader struct {
- *batch
+ *batchProcess
r io.Reader
}
func (br *batchReader) Read(p []byte) (int, error) {
+ br.batchProcess.Lock()
+ defer br.batchProcess.Unlock()
+
n, err := br.r.Read(p)
- br.batch.consume(n)
+ br.batchProcess.consume(n)
return n, err
}
diff --git a/internal/git/catfile/batch_cache.go b/internal/git/catfile/batch_cache.go
index 3b4714539..10ea489a1 100644
--- a/internal/git/catfile/batch_cache.go
+++ b/internal/git/catfile/batch_cache.go
@@ -1,22 +1,22 @@
package catfile
import (
- "context"
"strings"
"sync"
"time"
- "github.com/golang/groupcache/lru"
"github.com/prometheus/client_golang/prometheus"
"gitlab.com/gitlab-org/gitaly/internal/git/repository"
)
const (
- // CacheFeatureFlagKey is the feature flag key for catfile batch caching. This should match
- // what is in gitlab-ce
- CacheFeatureFlagKey = "catfile-cache"
+ // DefaultBatchfileTTL is the default ttl for batch files to live in the cache
+ DefaultBatchfileTTL = 10 * time.Second
+
// CacheMaxItems is the default configuration for maximum entries in the batch cache
CacheMaxItems = 100
+
+ defaultEvictionInterval = 1 * time.Second
)
var catfileCacheMembers = prometheus.NewGauge(
@@ -26,15 +26,24 @@ var catfileCacheMembers = prometheus.NewGauge(
},
)
-var cache *BatchCache
+var cache *batchCache
func init() {
prometheus.MustRegister(catfileCacheMembers)
- cache = NewCache(CacheMaxItems)
+ cache = newCache(DefaultBatchfileTTL, CacheMaxItems)
}
-// CacheKey is a key for the catfile cache
-type CacheKey struct {
+func newCacheKey(sessionID string, repo repository.GitRepo) key {
+ return key{
+ sessionID: sessionID,
+ repoStorage: repo.GetStorageName(),
+ repoRelPath: repo.GetRelativePath(),
+ repoObjDir: repo.GetGitObjectDirectory(),
+ repoAltDir: strings.Join(repo.GetGitAlternateObjectDirectories(), ","),
+ }
+}
+
+type key struct {
sessionID string
repoStorage string
repoRelPath string
@@ -42,135 +51,135 @@ type CacheKey struct {
repoAltDir string
}
-// CacheItem is a wrapper around Batch that provides a channel
-// through which the ttl goroutine can be stopped
-type CacheItem struct {
- batch *Batch
- stopTTL chan struct{}
- preserveBatchOnEvict bool
+type entry struct {
+ key
+ value *Batch
+ expiry time.Time
}
-// ExpireAll is used to expire all of the batches in the cache
-func ExpireAll() {
- cache.Lock()
- defer cache.Unlock()
- cache.lru.Clear()
-}
-
-// BatchCache is a cache containing batch objects based on session id and repository path
-type BatchCache struct {
+// batchCache entries always get added to the back of the list. If the
+// list gets too long, we evict entries from the front of the list. When
+// an entry gets added it gets an expiry time based on a fixed TTL. A
+// monitor goroutine periodically evicts expired entries.
+type batchCache struct {
+ entries []*entry
sync.Mutex
- lru *lru.Cache
+
+ // maxLen is the maximum number of keys in the cache
+ maxLen int
+
+ // ttl is the fixed ttl for cache entries
+ ttl time.Duration
}
-func closeBatchAndStopTTL(key lru.Key, value interface{}) {
- cacheItem := value.(*CacheItem)
- close(cacheItem.stopTTL)
+func newCache(ttl time.Duration, maxLen int) *batchCache {
+ return newCacheWithRefresh(ttl, maxLen, defaultEvictionInterval)
+}
- if !cacheItem.preserveBatchOnEvict {
- cacheItem.batch.Close()
+func newCacheWithRefresh(ttl time.Duration, maxLen int, refreshInterval time.Duration) *batchCache {
+ bc := &batchCache{
+ maxLen: maxLen,
+ ttl: ttl,
}
+
+ go bc.monitor(refreshInterval)
+ return bc
}
-// NewCache creates a new BatchCache
-func NewCache(maxEntries int) *BatchCache {
- lruCache := lru.New(maxEntries)
- lruCache.OnEvicted = closeBatchAndStopTTL
+func (bc *batchCache) monitor(refreshInterval time.Duration) {
+ ticker := time.NewTicker(refreshInterval)
- return &BatchCache{
- lru: lruCache,
+ for range ticker.C {
+ bc.EnforceTTL(time.Now())
}
}
-// Get retrieves a batch based on a CacheKey. We remove it from the lru so that other processes can't Get it.
-// however, since OnEvicted is called every time something is evicted from the cache, we need to signal to the OnEvicted
-// function that we don't want this batch to be closed. Therefore, we will update the cache entry with preserveBatchOnEvict set
-// to true.
-func (bc *BatchCache) Get(key CacheKey) *Batch {
+// Add adds a key, value pair to bc. If there are too many keys in bc
+// already Add will evict old keys until the length is OK again.
+func (bc *batchCache) Add(k key, b *Batch) {
bc.Lock()
defer bc.Unlock()
- catfileCacheMembers.Set(float64(bc.lru.Len()))
-
- v, ok := bc.lru.Get(key)
- if !ok {
- return nil
+ if i, ok := bc.lookup(k); ok {
+ catfileCacheCounter.WithLabelValues("duplicate").Inc()
+ bc.delete(i, true)
}
- cacheItem := v.(*CacheItem)
-
- // set preserveBatchOnEvict=true so that OnEvict doesn't close the batch
- cacheItem.preserveBatchOnEvict = true
- bc.lru.Add(key, cacheItem)
+ ent := &entry{key: k, value: b, expiry: time.Now().Add(bc.ttl)}
+ bc.entries = append(bc.entries, ent)
- bc.lru.Remove(key)
+ for bc.len() > bc.maxLen {
+ bc.evictHead()
+ }
- return cacheItem.batch
+ catfileCacheMembers.Set(float64(bc.len()))
}
-// Add Adds a batch based on a CacheKey. If there is already a batch for the given
-// key, it will remove and close the existing one, and Add the new one.
-func (bc *BatchCache) Add(key CacheKey, b *Batch, ttl time.Duration) {
+func (bc *batchCache) head() *entry { return bc.entries[0] }
+func (bc *batchCache) evictHead() { bc.delete(0, true) }
+func (bc *batchCache) len() int { return len(bc.entries) }
+
+// Checkout removes a value from bc. After use the caller can re-add the value with bc.Add.
+func (bc *batchCache) Checkout(k key) (*Batch, bool) {
bc.Lock()
defer bc.Unlock()
- if v, ok := bc.lru.Get(key); ok {
- existing := v.(*CacheItem)
- existing.batch.Close()
- bc.lru.Remove(key)
+ i, ok := bc.lookup(k)
+ if !ok {
+ catfileCacheCounter.WithLabelValues("miss").Inc()
+ return nil, false
}
- stopTTL := make(chan struct{})
+ catfileCacheCounter.WithLabelValues("hit").Inc()
- bc.lru.Add(key, &CacheItem{
- batch: b,
- stopTTL: stopTTL,
- })
+ ent := bc.entries[i]
+ bc.delete(i, false)
+ return ent.value, true
+}
- go func() {
- timer := time.NewTimer(ttl)
+// EnforceTTL evicts all entries older than now, assuming the entry
+// expiry times are increasing.
+func (bc *batchCache) EnforceTTL(now time.Time) {
+ bc.Lock()
+ defer bc.Unlock()
- select {
- case <-timer.C:
- bc.Del(key)
- // stopTTL channel is closed when the item is taken out of the cache so we don't have leaked goroutines
- case <-stopTTL:
- timer.Stop()
- }
- }()
+ for bc.len() > 0 && now.After(bc.head().expiry) {
+ bc.evictHead()
+ }
}
-// Del Deletes a batch based on a CacheKey
-func (bc *BatchCache) Del(key CacheKey) {
+func (bc *batchCache) EvictAll() {
bc.Lock()
defer bc.Unlock()
- bc.lru.Remove(key)
+ for bc.len() > 0 {
+ bc.evictHead()
+ }
}
-// returnToCache returns the batch to the cache
-func (bc *BatchCache) returnToCache(ctx context.Context, cacheKey CacheKey, b *Batch) {
- <-ctx.Done()
+// ExpireAll is used to expire all of the batches in the cache
+func ExpireAll() {
+ cache.EvictAll()
+}
- if b == nil || b.isClosed() {
- return
- }
+func (bc *batchCache) lookup(k key) (int, bool) {
+ for i, ent := range bc.entries {
+ if ent.key == k {
+ return i, true
+ }
- if b.HasUnreadData() {
- b.Close()
- return
}
- bc.Add(cacheKey, b, DefaultBatchfileTTL)
+ return -1, false
}
-// NewCacheKey return a cache key based on a session id and a git repository
-func NewCacheKey(sessionID string, repo repository.GitRepo) CacheKey {
- return CacheKey{
- sessionID: sessionID,
- repoStorage: repo.GetStorageName(),
- repoRelPath: repo.GetRelativePath(),
- repoObjDir: repo.GetGitObjectDirectory(),
- repoAltDir: strings.Join(repo.GetGitAlternateObjectDirectories(), ","),
+func (bc *batchCache) delete(i int, wantClose bool) {
+ ent := bc.entries[i]
+
+ if wantClose {
+ ent.value.Close()
}
+
+ bc.entries = append(bc.entries[:i], bc.entries[i+1:]...)
+ catfileCacheMembers.Set(float64(bc.len()))
}
diff --git a/internal/git/catfile/batch_cache_test.go b/internal/git/catfile/batch_cache_test.go
index 0de0a9469..0f885d314 100644
--- a/internal/git/catfile/batch_cache_test.go
+++ b/internal/git/catfile/batch_cache_test.go
@@ -1,59 +1,178 @@
-package catfile_test
+package catfile
import (
+ "fmt"
"testing"
"time"
- "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitaly/internal/git/catfile"
- "gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
-func TestBatchCacheTTL(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+func TestCacheAdd(t *testing.T) {
+ const maxLen = 3
+ bc := newCache(time.Hour, maxLen)
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
- defer cleanupFn()
+ key0 := testKey(0)
+ value0 := testValue()
+ bc.Add(key0, value0)
+ requireCacheValid(t, bc)
- batchCache := catfile.NewCache(10)
+ key1 := testKey(1)
+ bc.Add(key1, testValue())
+ requireCacheValid(t, bc)
- c, err := catfile.New(ctx, testRepo)
- require.NoError(t, err)
+ key2 := testKey(2)
+ bc.Add(key2, testValue())
+ requireCacheValid(t, bc)
- sessionID := "abcdefg1231231"
+ // Because maxLen is 3, and key0 is oldest, we expect that adding key3
+ // will kick out key0.
+ key3 := testKey(3)
+ bc.Add(key3, testValue())
+ requireCacheValid(t, bc)
- ttl := 5 * time.Millisecond
+ require.Equal(t, maxLen, bc.len(), "length should be maxLen")
+ require.True(t, value0.isClosed(), "value0 should be closed")
+ require.Equal(t, []key{key1, key2, key3}, keys(bc))
+}
+
+func TestCacheAddTwice(t *testing.T) {
+ bc := newCache(time.Hour, 10)
+
+ key0 := testKey(0)
+ value0 := testValue()
+ bc.Add(key0, value0)
+ requireCacheValid(t, bc)
+
+ key1 := testKey(1)
+ bc.Add(key1, testValue())
+ requireCacheValid(t, bc)
+
+ require.Equal(t, key0, bc.head().key, "key0 should be oldest key")
+
+ value2 := testValue()
+ bc.Add(key0, value2)
+ requireCacheValid(t, bc)
+
+ require.Equal(t, key1, bc.head().key, "key1 should be oldest key")
+ require.Equal(t, value2, bc.head().value)
+
+ require.True(t, value0.isClosed(), "value0 should be closed")
+}
+
+func TestCacheCheckout(t *testing.T) {
+ bc := newCache(time.Hour, 10)
+
+ key0 := testKey(0)
+ value0 := testValue()
+ bc.Add(key0, value0)
+
+ v, ok := bc.Checkout(key{sessionID: "foo"})
+ requireCacheValid(t, bc)
+ require.Nil(t, v, "expect nil value when key not found")
+ require.False(t, ok, "ok flag")
+
+ v, ok = bc.Checkout(key0)
+ requireCacheValid(t, bc)
+
+ require.Equal(t, value0, v)
+ require.True(t, ok, "ok flag")
+
+ require.False(t, v.isClosed(), "value should not be closed after checkout")
+
+ v, ok = bc.Checkout(key0)
+ require.False(t, ok, "ok flag after second checkout")
+ require.Nil(t, v, "value from second checkout")
+}
- cacheKey := catfile.NewCacheKey(sessionID, testRepo)
- batchCache.Add(cacheKey, c, ttl)
+func TestCacheEnforceTTL(t *testing.T) {
+ ttl := time.Hour
+ bc := newCache(ttl, 10)
- <-time.After(10 * time.Millisecond)
+ sleep := func() { time.Sleep(2 * time.Millisecond) }
- assert.Nil(t, batchCache.Get(cacheKey))
+ key0 := testKey(0)
+ value0 := testValue()
+ bc.Add(key0, value0)
+ sleep()
+
+ key1 := testKey(1)
+ value1 := testValue()
+ bc.Add(key1, value1)
+ sleep()
+
+ cutoff := time.Now().Add(ttl)
+ sleep()
+
+ key2 := testKey(2)
+ bc.Add(key2, testValue())
+ sleep()
+
+ key3 := testKey(3)
+ bc.Add(key3, testValue())
+ sleep()
+
+ requireCacheValid(t, bc)
+
+ // We expect this cutoff to cause eviction of key0 and key1 but no other keys.
+ bc.EnforceTTL(cutoff)
+
+ requireCacheValid(t, bc)
+
+ for i, v := range []*Batch{value0, value1} {
+ require.True(t, v.isClosed(), "value %d %v should be closed", i, v)
+ }
+
+ require.Equal(t, []key{key2, key3}, keys(bc), "remaining keys after EnforceTTL")
+
+ bc.EnforceTTL(cutoff)
+
+ requireCacheValid(t, bc)
+ require.Equal(t, []key{key2, key3}, keys(bc), "remaining keys after second EnforceTTL")
}
-func TestBatchCache(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+func TestAutoExpiry(t *testing.T) {
+ ttl := 5 * time.Millisecond
+ bc := newCacheWithRefresh(ttl, 10, 1*time.Millisecond)
- testRepo, _, cleanupFn := testhelper.NewTestRepo(t)
- defer cleanupFn()
+ key0 := testKey(0)
+ value0 := testValue()
+ bc.Add(key0, value0)
+ requireCacheValid(t, bc)
- batchCache := catfile.NewCache(10)
+ bc.Lock()
+ require.Contains(t, keys(bc), key0, "key should still be in map")
+ require.False(t, value0.isClosed(), "value should not have been closed")
+ bc.Unlock()
- c, err := catfile.New(ctx, testRepo)
- require.NoError(t, err)
+ time.Sleep(2 * ttl)
+
+ bc.Lock()
+ require.NotContains(t, keys(bc), key0, "key should no longer be in map")
+ require.True(t, value0.isClosed(), "value should be closed after eviction")
+ bc.Unlock()
+}
+
+func requireCacheValid(t *testing.T, bc *batchCache) {
+ bc.Lock()
+ defer bc.Unlock()
+
+ for _, ent := range bc.entries {
+
+ v := ent.value
+ require.False(t, v.isClosed(), "values in cache should not be closed: %v %v", ent, v)
+ }
+}
- sessionID := "abcdefg1231231"
+func testValue() *Batch { return &Batch{} }
- ttl := 10 * time.Second
+func testKey(i int) key { return key{sessionID: fmt.Sprintf("key-%d", i)} }
- cacheKey := catfile.NewCacheKey(sessionID, testRepo)
- batchCache.Add(cacheKey, c, ttl)
- b := batchCache.Get(cacheKey)
- defer b.Close()
+func keys(bc *batchCache) []key {
+ var result []key
+ for _, ent := range bc.entries {
+ result = append(result, ent.key)
+ }
- assert.Equal(t, c, b)
+ return result
}
diff --git a/internal/git/catfile/catfile.go b/internal/git/catfile/catfile.go
index 0794b0421..288470170 100644
--- a/internal/git/catfile/catfile.go
+++ b/internal/git/catfile/catfile.go
@@ -2,10 +2,8 @@ package catfile
import (
"context"
- "fmt"
"io"
"sync"
- "time"
"github.com/prometheus/client_golang/prometheus"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
@@ -14,7 +12,7 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag"
)
-var catfileCacheHitOrMiss = prometheus.NewCounterVec(
+var catfileCacheCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "gitaly_catfile_cache_total",
Help: "Counter of catfile cache hit/miss",
@@ -36,11 +34,14 @@ var totalCatfileProcesses = prometheus.NewCounter(
},
)
-// DefaultBatchfileTTL is the default ttl for batch files to live in the cache
-var DefaultBatchfileTTL = 10 * time.Second
+const (
+ // CacheFeatureFlagKey is the feature flag key for catfile batch caching. This should match
+ // what is in gitlab-ce
+ CacheFeatureFlagKey = "catfile-cache"
+)
func init() {
- prometheus.MustRegister(catfileCacheHitOrMiss)
+ prometheus.MustRegister(catfileCacheCounter)
prometheus.MustRegister(currentCatfileProcesses)
prometheus.MustRegister(totalCatfileProcesses)
}
@@ -53,7 +54,7 @@ func init() {
type Batch struct {
sync.Mutex
*batchCheck
- *batch
+ *batchProcess
cancel func()
closed bool
}
@@ -69,7 +70,7 @@ func (c *Batch) Info(revspec string) (*ObjectInfo, error) {
// and check the object type. Caller must consume the Reader before
// making another call on C.
func (c *Batch) Tree(revspec string) (io.Reader, error) {
- return c.batch.reader(revspec, "tree")
+ return c.batchProcess.reader(revspec, "tree")
}
// Commit returns a raw commit object. It is an error if revspec does not
@@ -77,7 +78,7 @@ func (c *Batch) Tree(revspec string) (io.Reader, error) {
// and check the object type. Caller must consume the Reader before
// making another call on C.
func (c *Batch) Commit(revspec string) (io.Reader, error) {
- return c.batch.reader(revspec, "commit")
+ return c.batchProcess.reader(revspec, "commit")
}
// Blob returns a reader for the requested blob. The entire blob must be
@@ -86,13 +87,13 @@ func (c *Batch) Commit(revspec string) (io.Reader, error) {
// It is an error if revspec does not point to a blob. To prevent this
// first use Info to resolve the revspec and check the object type.
func (c *Batch) Blob(revspec string) (io.Reader, error) {
- return c.batch.reader(revspec, "blob")
+ return c.batchProcess.reader(revspec, "blob")
}
// Tag returns a raw tag object. Caller must consume the Reader before
// making another call on C.
func (c *Batch) Tag(revspec string) (io.Reader, error) {
- return c.batch.reader(revspec, "tag")
+ return c.batchProcess.reader(revspec, "tag")
}
// Close closes the writers for batchCheck and batch. This is only used for
@@ -119,12 +120,6 @@ func (c *Batch) isClosed() bool {
return c.closed
}
-// HasUnreadData returns a boolean specifying whether or not the Batch has more
-// data still to be read
-func (c *Batch) HasUnreadData() bool {
- return c.n > 1
-}
-
// New returns a new Batch instance. It is important that ctx gets canceled
// somewhere, because if it doesn't the cat-file processes spawned by
// New() never terminate.
@@ -141,51 +136,57 @@ func New(ctx context.Context, repo *gitalypb.Repository) (*Batch, error) {
sessionID := metadata.GetValue(ctx, "gitaly-session-id")
if featureflag.IsDisabled(ctx, CacheFeatureFlagKey) || sessionID == "" {
- // if caching us used, the caller is responsible for putting the catfile
- // into the cache
- batch, err := newBatch(ctx, repoPath, env)
- if err != nil {
- return nil, err
- }
-
- batchCheck, err := newBatchCheck(ctx, repoPath, env)
- if err != nil {
- return nil, err
- }
-
- return &Batch{batch: batch, batchCheck: batchCheck}, nil
+ return newBatch(ctx, repoPath, env)
}
- cacheKey := NewCacheKey(sessionID, repo)
-
- c := cache.Get(cacheKey)
+ cacheKey := newCacheKey(sessionID, repo)
+ requestDone := ctx.Done()
- defer func() {
- go cache.returnToCache(ctx, cacheKey, c)
- }()
-
- if c != nil {
- catfileCacheHitOrMiss.WithLabelValues("hit").Inc()
- cache.Del(cacheKey)
+ if c, ok := cache.Checkout(cacheKey); ok {
+ go returnWhenDone(requestDone, cache, cacheKey, c)
return c, nil
}
- catfileCacheHitOrMiss.WithLabelValues("miss").Inc()
// if we are using caching, create a fresh context for the new batch
// and initialize the new batch with a cache key and cancel function
cacheCtx, cacheCancel := context.WithCancel(context.Background())
- c = &Batch{cancel: cacheCancel}
-
- c.batch, err = newBatch(cacheCtx, repoPath, env)
+ c, err := newBatch(cacheCtx, repoPath, env)
if err != nil {
- return nil, fmt.Errorf("error when creating new batch: %v", err)
+ return nil, err
}
- c.batchCheck, err = newBatchCheck(cacheCtx, repoPath, env)
+ c.cancel = cacheCancel
+ go returnWhenDone(requestDone, cache, cacheKey, c)
+
+ return c, nil
+}
+
+func returnWhenDone(done <-chan struct{}, bc *batchCache, cacheKey key, c *Batch) {
+ <-done
+
+ if c == nil || c.isClosed() {
+ return
+ }
+
+ if c.hasUnreadData() {
+ catfileCacheCounter.WithLabelValues("dirty").Inc()
+ c.Close()
+ return
+ }
+
+ bc.Add(cacheKey, c)
+}
+
+func newBatch(ctx context.Context, repoPath string, env []string) (*Batch, error) {
+ batch, err := newBatchProcess(ctx, repoPath, env)
if err != nil {
- return nil, fmt.Errorf("error when creating new batch check: %v", err)
+ return nil, err
}
- return c, nil
+ batchCheck, err := newBatchCheck(ctx, repoPath, env)
+ if err != nil {
+ return nil, err
+ }
+ return &Batch{batchProcess: batch, batchCheck: batchCheck}, nil
}
diff --git a/vendor/github.com/golang/groupcache/LICENSE b/vendor/github.com/golang/groupcache/LICENSE
deleted file mode 100644
index 37ec93a14..000000000
--- a/vendor/github.com/golang/groupcache/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/golang/groupcache/lru/lru.go b/vendor/github.com/golang/groupcache/lru/lru.go
deleted file mode 100644
index eac1c7664..000000000
--- a/vendor/github.com/golang/groupcache/lru/lru.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Copyright 2013 Google Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package lru implements an LRU cache.
-package lru
-
-import "container/list"
-
-// Cache is an LRU cache. It is not safe for concurrent access.
-type Cache struct {
- // MaxEntries is the maximum number of cache entries before
- // an item is evicted. Zero means no limit.
- MaxEntries int
-
- // OnEvicted optionally specifies a callback function to be
- // executed when an entry is purged from the cache.
- OnEvicted func(key Key, value interface{})
-
- ll *list.List
- cache map[interface{}]*list.Element
-}
-
-// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
-type Key interface{}
-
-type entry struct {
- key Key
- value interface{}
-}
-
-// New creates a new Cache.
-// If maxEntries is zero, the cache has no limit and it's assumed
-// that eviction is done by the caller.
-func New(maxEntries int) *Cache {
- return &Cache{
- MaxEntries: maxEntries,
- ll: list.New(),
- cache: make(map[interface{}]*list.Element),
- }
-}
-
-// Add adds a value to the cache.
-func (c *Cache) Add(key Key, value interface{}) {
- if c.cache == nil {
- c.cache = make(map[interface{}]*list.Element)
- c.ll = list.New()
- }
- if ee, ok := c.cache[key]; ok {
- c.ll.MoveToFront(ee)
- ee.Value.(*entry).value = value
- return
- }
- ele := c.ll.PushFront(&entry{key, value})
- c.cache[key] = ele
- if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries {
- c.RemoveOldest()
- }
-}
-
-// Get looks up a key's value from the cache.
-func (c *Cache) Get(key Key) (value interface{}, ok bool) {
- if c.cache == nil {
- return
- }
- if ele, hit := c.cache[key]; hit {
- c.ll.MoveToFront(ele)
- return ele.Value.(*entry).value, true
- }
- return
-}
-
-// Remove removes the provided key from the cache.
-func (c *Cache) Remove(key Key) {
- if c.cache == nil {
- return
- }
- if ele, hit := c.cache[key]; hit {
- c.removeElement(ele)
- }
-}
-
-// RemoveOldest removes the oldest item from the cache.
-func (c *Cache) RemoveOldest() {
- if c.cache == nil {
- return
- }
- ele := c.ll.Back()
- if ele != nil {
- c.removeElement(ele)
- }
-}
-
-func (c *Cache) removeElement(e *list.Element) {
- c.ll.Remove(e)
- kv := e.Value.(*entry)
- delete(c.cache, kv.key)
- if c.OnEvicted != nil {
- c.OnEvicted(kv.key, kv.value)
- }
-}
-
-// Len returns the number of items in the cache.
-func (c *Cache) Len() int {
- if c.cache == nil {
- return 0
- }
- return c.ll.Len()
-}
-
-// Clear purges all stored items from the cache.
-func (c *Cache) Clear() {
- if c.OnEvicted != nil {
- for _, e := range c.cache {
- kv := e.Value.(*entry)
- c.OnEvicted(kv.key, kv.value)
- }
- }
- c.ll = nil
- c.cache = nil
-}
diff --git a/vendor/vendor.json b/vendor/vendor.json
index c30ecbf25..b87802714 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -61,12 +61,6 @@
"versionExact": "v0.1.0"
},
{
- "checksumSHA1": "LHNzQwau1zPeFPPG5zbNf8AgUOQ=",
- "path": "github.com/golang/groupcache/lru",
- "revision": "5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b",
- "revisionTime": "2019-01-29T15:46:38Z"
- },
- {
"checksumSHA1": "BP2buXHHOKxI5eYS2xELVng2kf4=",
"path": "github.com/golang/protobuf/jsonpb",
"revision": "c823c79ea1570fb5ff454033735a8e68575d1d0f",