[ https://issues.apache.org/jira/browse/IGNITE-1423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14819650#comment-14819650 ]
Pavel Tupitsyn commented on IGNITE-1423: ----------------------------------------- Roman, why do you think so? See javax.cache.expiry.ExpiryPolicy javadoc: "If a {@link Duration#ZERO} is returned the new Cache.Entry is considered to be already expired and will not be added to the Cache.". So containsKey should return false. > 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.5 > > > 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)