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

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: Rewrite with errors.Filter 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
« filter/dscache/ds.go ('K') | « 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"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 if err := s.mc.SetMulti(lockItems); err != nil { 111 if err := s.mc.SetMulti(lockItems); err != nil {
112 // this is a hard failure. No mutation can occur if we're unable to set 112 // this is a hard failure. No mutation can occur if we're unable to set
113 // locks out. See "DANGER ZONE" in the docs. 113 // locks out. See "DANGER ZONE" in the docs.
114 (log.Fields{log.ErrorKey: err}).Errorf( 114 (log.Fields{log.ErrorKey: err}).Errorf(
115 s.c, "dscache: HARD FAILURE: supportContext.mutation(): mc.SetMulti") 115 s.c, "dscache: HARD FAILURE: supportContext.mutation(): mc.SetMulti")
116 return err 116 return err
117 } 117 }
118 err := f() 118 err := f()
119 if err == nil { 119 if err == nil {
120 » » if err := s.mc.DeleteMulti(lockKeys); err != nil { 120 » » if err := filterMCErr(s.mc.DeleteMulti(lockKeys)); err != nil {
121 (log.Fields{log.ErrorKey: err}).Warningf( 121 (log.Fields{log.ErrorKey: err}).Warningf(
122 s.c, "dscache: mc.DeleteMulti") 122 s.c, "dscache: mc.DeleteMulti")
123 } 123 }
124 } 124 }
125 return err 125 return err
126 } 126 }
127 127
128 func (s *supportContext) mkRandLockItems(keys []*ds.Key, metas ds.MultiMetaGette r) ([]memcache.Item, []byte) { 128 func (s *supportContext) mkRandLockItems(keys []*ds.Key, metas ds.MultiMetaGette r) ([]memcache.Item, []byte) {
129 mcKeys := s.mkRandKeys(keys, metas) 129 mcKeys := s.mkRandKeys(keys, metas)
130 if len(mcKeys) == 0 { 130 if len(mcKeys) == 0 {
(...skipping 19 matching lines...) Expand all
150 return nil, nil 150 return nil, nil
151 } 151 }
152 ret := make([]memcache.Item, len(mcKeys)) 152 ret := make([]memcache.Item, len(mcKeys))
153 for i := range ret { 153 for i := range ret {
154 ret[i] = (s.mc.NewItem(mcKeys[i]). 154 ret[i] = (s.mc.NewItem(mcKeys[i]).
155 SetFlags(uint32(ItemHasLock)). 155 SetFlags(uint32(ItemHasLock)).
156 SetExpiration(time.Second * time.Duration(LockTimeSecond s))) 156 SetExpiration(time.Second * time.Duration(LockTimeSecond s)))
157 } 157 }
158 return ret, mcKeys 158 return ret, mcKeys
159 } 159 }
OLDNEW
« filter/dscache/ds.go ('K') | « filter/dscache/ds_txn_state.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698