Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Reminiscent committed Mar 15, 2022
1 parent 77598b4 commit 3691299
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bindinfo/bind_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *bindCache) get(key bindCacheKey) []*BindRecord {
func (c *bindCache) set(key bindCacheKey, value []*BindRecord) (ok bool, err error) {
mem := calcBindCacheKVMem(key, value)
if mem > c.memCapacity { // ignore this kv pair if its size is too large
err = errors.New("The memory usage of the binding_cache exceeds its capacity. The cache can't hold all of the available bindings")
err = errors.New("The memory usage of all available bindings exceeds the cache's mem quota. As a result, all available bindings cannot be held on the cache. Please increase the value of the system variable 'tidb_mem_quota_binding_cache' and execute 'admin reload bindings' to ensure that all bindings exist in the cache and can be used normally")
return
}
bindRecords := c.get(key)
Expand All @@ -89,7 +89,7 @@ func (c *bindCache) set(key bindCacheKey, value []*BindRecord) (ok bool, err err
mem -= calcBindCacheKVMem(key, bindRecords)
}
for mem+c.memTracker.BytesConsumed() > c.memCapacity {
err = errors.New("The memory usage of the binding_cache exceeds its capacity. The cache can't hold all of the available bindings")
err = errors.New("The memory usage of all available bindings exceeds the cache's mem quota. As a result, all available bindings cannot be held on the cache. Please increase the value of the system variable 'tidb_mem_quota_binding_cache' and execute 'admin reload bindings' to ensure that all bindings exist in the cache and can be used normally")
evictedKey, evictedValue, evicted := c.cache.RemoveOldest()
if !evicted {
return
Expand Down Expand Up @@ -211,7 +211,7 @@ func (c *bindCache) Copy() (newCache *bindCache, err error) {
defer c.lock.Unlock()
newCache = newBindCache()
if c.memTracker.BytesConsumed() > newCache.GetMemCapacity() {
err = errors.New("The memory usage of the binding_cache exceeds its capacity. The cache can't hold all of the available bindings")
err = errors.New("The memory usage of all available bindings exceeds the cache's mem quota. As a result, all available bindings cannot be held on the cache. Please increase the value of the system variable 'tidb_mem_quota_binding_cache' and execute 'admin reload bindings' to ensure that all bindings exist in the cache and can be used normally")
}
keys := c.cache.Keys()
for _, key := range keys {
Expand Down
3 changes: 2 additions & 1 deletion bindinfo/session_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ func (h *SessionHandle) DropBindRecord(originalSQL, db string, binding *Binding)
}
err := h.ch.SetBindRecord(hash, newRecord)
if err != nil {
logutil.BgLogger().Warn("[sql-bind] ", zap.Error(err))
// Should never reach here, just return an error for safety
return err
}
updateMetrics(metrics.ScopeSession, oldRecord, newRecord, false)
return nil
Expand Down

0 comments on commit 3691299

Please sign in to comment.