You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (JIRA)" <ji...@apache.org> on 2015/09/11 16:15:46 UTC

[jira] [Updated] (IGNITE-1423) Zero expiry policy does not work sometimes

     [ https://issues.apache.org/jira/browse/IGNITE-1423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel  Tupitsyn updated IGNITE-1423:
------------------------------------
    Description: 
Paste the following test to GridCacheReplicatedMultiNodeFullApiSelfTest.java and run.
Last assertion fails. Cycle is necessary because it does not always fail.

{code:title=GridCacheReplicatedMultiNodeFullApiSelfTest.java}
    public void testExpiredBug() throws Exception {
        final ExpiryPolicy plc = new ExpiryPolicy() {
            @Override public Duration getExpiryForCreation() {
                return Duration.ZERO;
            }

            @Override public Duration getExpiryForAccess() {
                return Duration.ZERO;
            }

            @Override public Duration getExpiryForUpdate() {
                return Duration.ZERO;
            }
        };

        IgniteCache c1 = ignite(0).cache(null);
        IgniteCache c2 = ignite(1).cache(null);

        String key0 = primaryKeysForCache(c1, 1).get(0);
        String key1 = primaryKeysForCache(c2, 1).get(0);

        IgniteCache cache0 = c1;
        IgniteCache cache = c1.withExpiryPolicy(plc);

        for (int i = 0; i < 3000; i++) {
            cache.put(key0, key0);
            cache.put(key1, key1);
            assert !cache0.containsKey(key0);
            assert !cache0.containsKey(key1);

            cache0.put(key0, key0);
            cache0.put(key1, key1);
            assert cache0.containsKey(key0);
            assert cache0.containsKey(key1);
            cache.put(key0, key0 + 1);
            cache.put(key1, key1 + 1);
            assert !cache0.containsKey(key0);
            assert !cache0.containsKey(key1);

            cache0.put(key0, key0);
            cache0.put(key1, key1);
            cache.get(key0);
            cache.get(key1);
            assert !cache0.containsKey(key0);
            assert !cache0.containsKey(key1);
        }
    }}
{code}

  was:
Paste the following test to GridCacheReplicatedMultiNodeFullApiSelfTest.java and run.

{code:title=GridCacheReplicatedMultiNodeFullApiSelfTest.java}
    public void testExpiredBug() throws Exception {
        final ExpiryPolicy plc = new ExpiryPolicy() {
            @Override public Duration getExpiryForCreation() {
                return Duration.ZERO;
            }

            @Override public Duration getExpiryForAccess() {
                return Duration.ZERO;
            }

            @Override public Duration getExpiryForUpdate() {
                return Duration.ZERO;
            }
        };

        IgniteCache c1 = ignite(0).cache(null);
        IgniteCache c2 = ignite(1).cache(null);

        String key0 = primaryKeysForCache(c1, 1).get(0);
        String key1 = primaryKeysForCache(c2, 1).get(0);

        IgniteCache cache0 = c1;
        IgniteCache cache = c1.withExpiryPolicy(plc);

        for (int i = 0; i < 3000; i++) {
            cache.put(key0, key0);
            cache.put(key1, key1);
            assert !cache0.containsKey(key0);
            assert !cache0.containsKey(key1);

            cache0.put(key0, key0);
            cache0.put(key1, key1);
            assert cache0.containsKey(key0);
            assert cache0.containsKey(key1);
            cache.put(key0, key0 + 1);
            cache.put(key1, key1 + 1);
            assert !cache0.containsKey(key0);
            assert !cache0.containsKey(key1);

            cache0.put(key0, key0);
            cache0.put(key1, key1);
            cache.get(key0);
            cache.get(key1);
            assert !cache0.containsKey(key0);
            assert !cache0.containsKey(key1);
        }
    }}
{code}


> Zero expiry policy does not work sometimes
> ------------------------------------------
>
>                 Key: IGNITE-1423
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1423
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 1.1.4
>            Reporter: Pavel  Tupitsyn
>             Fix For: ignite-1.4
>
>
> Paste the following test to GridCacheReplicatedMultiNodeFullApiSelfTest.java and run.
> Last assertion fails. Cycle is necessary because it does not always fail.
> {code:title=GridCacheReplicatedMultiNodeFullApiSelfTest.java}
>     public void testExpiredBug() throws Exception {
>         final ExpiryPolicy plc = new ExpiryPolicy() {
>             @Override public Duration getExpiryForCreation() {
>                 return Duration.ZERO;
>             }
>             @Override public Duration getExpiryForAccess() {
>                 return Duration.ZERO;
>             }
>             @Override public Duration getExpiryForUpdate() {
>                 return Duration.ZERO;
>             }
>         };
>         IgniteCache c1 = ignite(0).cache(null);
>         IgniteCache c2 = ignite(1).cache(null);
>         String key0 = primaryKeysForCache(c1, 1).get(0);
>         String key1 = primaryKeysForCache(c2, 1).get(0);
>         IgniteCache cache0 = c1;
>         IgniteCache cache = c1.withExpiryPolicy(plc);
>         for (int i = 0; i < 3000; i++) {
>             cache.put(key0, key0);
>             cache.put(key1, key1);
>             assert !cache0.containsKey(key0);
>             assert !cache0.containsKey(key1);
>             cache0.put(key0, key0);
>             cache0.put(key1, key1);
>             assert cache0.containsKey(key0);
>             assert cache0.containsKey(key1);
>             cache.put(key0, key0 + 1);
>             cache.put(key1, key1 + 1);
>             assert !cache0.containsKey(key0);
>             assert !cache0.containsKey(key1);
>             cache0.put(key0, key0);
>             cache0.put(key1, key1);
>             cache.get(key0);
>             cache.get(key1);
>             assert !cache0.containsKey(key0);
>             assert !cache0.containsKey(key1);
>         }
>     }}
> {code}



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