Skip to content

Commit fa6c2a8

Browse files
Merge branch 'main' of https://github.com/paypal/hera into fixPanic0503
2 parents b6b8cd3 + 850f18c commit fa6c2a8

File tree

13 files changed

+1019
-149
lines changed

13 files changed

+1019
-149
lines changed

lib/bindevict.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ type BindEvict struct {
4242
// evicted binds get throttled to have overall steady state during bad bind queries
4343
// nested map uses sqlhash "bindName|bindValue"
4444
BindThrottle map[uint32]map[string]*BindThrottle
45-
lock sync.Mutex
45+
lock sync.Mutex
4646
}
4747

4848
func GetBindEvict() *BindEvict {
4949
cfg := gBindEvict.Load()
5050
if cfg == nil {
51-
out := BindEvict{BindThrottle:make(map[uint32]map[string]*BindThrottle)}
51+
out := BindEvict{BindThrottle: make(map[uint32]map[string]*BindThrottle)}
5252
gBindEvict.Store(&out)
5353
return &out
5454
}
@@ -77,7 +77,7 @@ func NormalizeBindName(bindName0 string) string {
7777

7878
func (entry *BindThrottle) decrAllowEveryX(y int) {
7979
if y >= 2 && logger.GetLogger().V(logger.Warning) {
80-
info := fmt.Sprintf("hash:%d bindName:%s val:%s allowEveryX:%d-%d",entry.Sqlhash, entry.Name, entry.Value, entry.AllowEveryX, y)
80+
info := fmt.Sprintf("hash:%d bindName:%s val:%s allowEveryX:%d-%d", entry.Sqlhash, entry.Name, entry.Value, entry.AllowEveryX, y)
8181
logger.GetLogger().Log(logger.Warning, "bind throttle decr", info)
8282
}
8383
entry.AllowEveryX -= y
@@ -88,7 +88,7 @@ func (entry *BindThrottle) decrAllowEveryX(y int) {
8888
}
8989
func (entry *BindThrottle) incrAllowEveryX() {
9090
if logger.GetLogger().V(logger.Warning) {
91-
info := fmt.Sprintf("hash:%d bindName:%s val:%s prev:%d",entry.Sqlhash, entry.Name, entry.Value, entry.AllowEveryX)
91+
info := fmt.Sprintf("hash:%d bindName:%s val:%s prev:%d", entry.Sqlhash, entry.Name, entry.Value, entry.AllowEveryX)
9292
logger.GetLogger().Log(logger.Warning, "bind throttle incr", info)
9393
}
9494
entry.AllowEveryX = 3*entry.AllowEveryX + 1
@@ -153,7 +153,7 @@ func (bindEvict *BindEvict) ShouldBlock(sqlhash uint32, bindKV map[string]string
153153
entry.RecentAttempt.Store(&now)
154154
entry.AllowEveryXCount++
155155
if entry.AllowEveryXCount < entry.AllowEveryX {
156-
return true/*block*/, entry
156+
return true /*block*/, entry
157157
}
158158
entry.AllowEveryXCount = 0
159159

0 commit comments

Comments
 (0)