You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/05/23 12:41:12 UTC

[jira] [Commented] (IGNITE-2888) Eviction policy not called upon cache.remove()

    [ https://issues.apache.org/jira/browse/IGNITE-2888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15296321#comment-15296321 ] 

ASF GitHub Bot commented on IGNITE-2888:
----------------------------------------

GitHub user ilantukh opened a pull request:

    https://github.com/apache/ignite/pull/745

    IGNITE-2888

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ilantukh/ignite ignite-2888

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/745.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #745
    
----
commit a8e48f074c37f1d0ed4c2c9775b658aea7b3c85f
Author: Ilya Lantukh <il...@gridgain.com>
Date:   2016-05-23T11:58:59Z

    ignite-2888 : Extended ConcurrentEvictionConsistencyTest to test different cache configurations.

commit 5311fecea91cba4c2e235356338f23f03c7a2674
Author: Ilya Lantukh <il...@gridgain.com>
Date:   2016-05-23T12:14:36Z

    ignite-2888 : Disabled skipping of removed entries during unlock.

----


> Eviction policy not called upon cache.remove()
> ----------------------------------------------
>
>                 Key: IGNITE-2888
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2888
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 1.5.0.final
>         Environment: java version "1.8.0_73"
> Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
> Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
> Windows 10 64bit
>            Reporter: Avihai Berkovitz
>            Assignee: Ilya Lantukh
>
> When I set an eviction policy to a cache it doesn't get called when removing an entry from the cache. This only happens when using a *REPLICATED* or *PARTITIONED* cache, and only in *ATOMIC* mode. This is the reason it never came up in the GridCacheConcurrentEvictionConsistencySelfTest test. If you change the cache parameters in the test you can see the problem easily.
> This causes two problems:
> * Cache entries that were deleted still remain in memory, because the objects are referenced by the policy
> * The eviction policy "thinks" the cache is larger than it really is, so entries might be evicted even if there is no need for it
> Here is a small test case to illustrate the problem:
> {code}
> IgniteConfiguration igniteConfig = new IgniteConfiguration()
>         .setGridLogger(new Slf4jLogger())
>         .setDeploymentMode(DeploymentMode.CONTINUOUS);
> try (Ignite ignite = Ignition.start(igniteConfig)) {
>     LruEvictionPolicy evictionPolicy = new LruEvictionPolicy(30);
>     CacheConfiguration<String, String> cacheConfiguration = new CacheConfiguration<String, String>()
>             .setName("test")
>             .setCacheMode(CacheMode.REPLICATED)
>             .setAtomicityMode(CacheAtomicityMode.ATOMIC)
>             .setEvictionPolicy(evictionPolicy);
>     IgniteCache<String, String> cache = ignite.getOrCreateCache(cacheConfiguration);
>     for (int i = 1; i <= 100; i++) {
>         cache.put("key" + i, "data");
>         System.out.println(String.format("Size: %d, LRU: %d", cache.size(CachePeekMode.ALL), evictionPolicy.getCurrentSize()));
>         if (i % 5 == 0) {
>             cache.remove("key" + (i-1));
>             System.out.println(String.format("Size: %d, LRU: %d", cache.size(CachePeekMode.ALL), evictionPolicy.getCurrentSize()));
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)