Nikolai Kulagin created IGNITE-12693:
----------------------------------------

             Summary: Incorrect operation of the eviction policy internal 
counter
                 Key: IGNITE-12693
                 URL: https://issues.apache.org/jira/browse/IGNITE-12693
             Project: Ignite
          Issue Type: Bug
          Components: cache
            Reporter: Nikolai Kulagin
         Attachments: EvictionPoliciesReproducer.java

When an entry is added to the cache, its size is added to the internal policy 
counter. When the size of the internal counter exceeds the max, entries begin 
to evict until the internal size is less than the maximum.

When deleting, the size of the entry is subtracted from the internal counter, 
but since when deleting an element, only its key is most often indicated, only 
the key size is subtracted. This way you can get the moment when the cache is 
empty, but the size of the internal counter is not.


{code:java}
    @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> 
entry) {
        if (!rmv) {
        ...
        else {
            Object node = entry.removeMeta();

            if (node != null) {
                removeMeta(node);

                memSize.add(-entry.size());
            }
        }
    }
{code}

In the worst case, a situation is possible when an object added to an empty 
cache is evicted, although it is much smaller than the maximum size.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to