You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
store/cache: fix broken metric and current index cache size handling (#873)
* store/cache: do not forget to increase c.current on adding new items
* store/cache: properly adjust c.curSize
* store/cache: prevent uint64 overflow by switching operands
Adding uint64(len(b)) to c.curSize might potentially overflow uint64 if
the numbers are big enough and then we might not remove enough items
from the LRU to satisfy the request. On the other hand, switching the
operands avoids this problem because we check before if uint64(len(b))
is bigger than c.maxSize so subtracting uint64(len(b)) will *never*
overflow because we know that it is less or equal to c.maxSize.
* store/cache: revert ensureFits() changes
c.curSize is lowered in onEvict.
* store/cache: add smoke tests
Add smoke tests for the index cache which check if we set curSize
properly, and if removal works.
0 commit comments