Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: filter/dscache/support.go

Issue 1695833002: dscache: Only log unusual memcache errors. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: inline. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « filter/dscache/ds_txn_state.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package dscache 5 package dscache
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "math/rand" 9 "math/rand"
10 "time" 10 "time"
11 11
12 ds "github.com/luci/gae/service/datastore" 12 ds "github.com/luci/gae/service/datastore"
13 "github.com/luci/gae/service/memcache" 13 "github.com/luci/gae/service/memcache"
14 "github.com/luci/luci-go/common/errors"
14 log "github.com/luci/luci-go/common/logging" 15 log "github.com/luci/luci-go/common/logging"
15 "golang.org/x/net/context" 16 "golang.org/x/net/context"
16 ) 17 )
17 18
18 type supportContext struct { 19 type supportContext struct {
19 aid string 20 aid string
20 ns string 21 ns string
21 22
22 c context.Context 23 c context.Context
23 mc memcache.Interface 24 mc memcache.Interface
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 111 }
111 if err := s.mc.SetMulti(lockItems); err != nil { 112 if err := s.mc.SetMulti(lockItems); err != nil {
112 // this is a hard failure. No mutation can occur if we're unable to set 113 // this is a hard failure. No mutation can occur if we're unable to set
113 // locks out. See "DANGER ZONE" in the docs. 114 // locks out. See "DANGER ZONE" in the docs.
114 (log.Fields{log.ErrorKey: err}).Errorf( 115 (log.Fields{log.ErrorKey: err}).Errorf(
115 s.c, "dscache: HARD FAILURE: supportContext.mutation(): mc.SetMulti") 116 s.c, "dscache: HARD FAILURE: supportContext.mutation(): mc.SetMulti")
116 return err 117 return err
117 } 118 }
118 err := f() 119 err := f()
119 if err == nil { 120 if err == nil {
120 » » if err := s.mc.DeleteMulti(lockKeys); err != nil { 121 » » if err := errors.Filter(s.mc.DeleteMulti(lockKeys), memcache.Err CacheMiss); err != nil {
121 (log.Fields{log.ErrorKey: err}).Warningf( 122 (log.Fields{log.ErrorKey: err}).Warningf(
122 s.c, "dscache: mc.DeleteMulti") 123 s.c, "dscache: mc.DeleteMulti")
123 } 124 }
124 } 125 }
125 return err 126 return err
126 } 127 }
127 128
128 func (s *supportContext) mkRandLockItems(keys []*ds.Key, metas ds.MultiMetaGette r) ([]memcache.Item, []byte) { 129 func (s *supportContext) mkRandLockItems(keys []*ds.Key, metas ds.MultiMetaGette r) ([]memcache.Item, []byte) {
129 mcKeys := s.mkRandKeys(keys, metas) 130 mcKeys := s.mkRandKeys(keys, metas)
130 if len(mcKeys) == 0 { 131 if len(mcKeys) == 0 {
(...skipping 19 matching lines...) Expand all
150 return nil, nil 151 return nil, nil
151 } 152 }
152 ret := make([]memcache.Item, len(mcKeys)) 153 ret := make([]memcache.Item, len(mcKeys))
153 for i := range ret { 154 for i := range ret {
154 ret[i] = (s.mc.NewItem(mcKeys[i]). 155 ret[i] = (s.mc.NewItem(mcKeys[i]).
155 SetFlags(uint32(ItemHasLock)). 156 SetFlags(uint32(ItemHasLock)).
156 SetExpiration(time.Second * time.Duration(LockTimeSecond s))) 157 SetExpiration(time.Second * time.Duration(LockTimeSecond s)))
157 } 158 }
158 return ret, mcKeys 159 return ret, mcKeys
159 } 160 }
OLDNEW
« no previous file with comments | « filter/dscache/ds_txn_state.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698