@@ -42,13 +42,13 @@ type BindEvict struct {
42
42
// evicted binds get throttled to have overall steady state during bad bind queries
43
43
// nested map uses sqlhash "bindName|bindValue"
44
44
BindThrottle map [uint32 ]map [string ]* BindThrottle
45
- lock sync.Mutex
45
+ lock sync.Mutex
46
46
}
47
47
48
48
func GetBindEvict () * BindEvict {
49
49
cfg := gBindEvict .Load ()
50
50
if cfg == nil {
51
- out := BindEvict {BindThrottle :make (map [uint32 ]map [string ]* BindThrottle )}
51
+ out := BindEvict {BindThrottle : make (map [uint32 ]map [string ]* BindThrottle )}
52
52
gBindEvict .Store (& out )
53
53
return & out
54
54
}
@@ -77,7 +77,7 @@ func NormalizeBindName(bindName0 string) string {
77
77
78
78
func (entry * BindThrottle ) decrAllowEveryX (y int ) {
79
79
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 )
81
81
logger .GetLogger ().Log (logger .Warning , "bind throttle decr" , info )
82
82
}
83
83
entry .AllowEveryX -= y
@@ -88,7 +88,7 @@ func (entry *BindThrottle) decrAllowEveryX(y int) {
88
88
}
89
89
func (entry * BindThrottle ) incrAllowEveryX () {
90
90
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 )
92
92
logger .GetLogger ().Log (logger .Warning , "bind throttle incr" , info )
93
93
}
94
94
entry .AllowEveryX = 3 * entry .AllowEveryX + 1
@@ -153,7 +153,7 @@ func (bindEvict *BindEvict) ShouldBlock(sqlhash uint32, bindKV map[string]string
153
153
entry .RecentAttempt .Store (& now )
154
154
entry .AllowEveryXCount ++
155
155
if entry .AllowEveryXCount < entry .AllowEveryX {
156
- return true /*block*/ , entry
156
+ return true /*block*/ , entry
157
157
}
158
158
entry .AllowEveryXCount = 0
159
159
0 commit comments