Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMap.putAll entries were never evicted on map with ttl configured (only 2.6.1) #670

Closed
notz opened this issue Aug 13, 2013 · 1 comment

Comments

Projects
None yet
1 participant
@notz
Copy link
Contributor

commented Aug 13, 2013

On 2.6.1 if you put some entries to a distributed map that has a ttl configuered the entries don't get evicted. It's working in 2.6, 2.5.1, 3.0 but not in 2.6.1.

import java.util.HashMap;
import java.util.concurrent.TimeUnit;

import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;


public class MapTtlTest {

    public static void main(String[] args) throws Exception {

        Config config = new Config();
        MapConfig mapConfig = new MapConfig("ttl-test");
        mapConfig.setTimeToLiveSeconds(5);
        config.addMapConfig(mapConfig);

        HazelcastInstance cluster = Hazelcast.newHazelcastInstance(config);

        IMap<Long, Boolean> clusterTtlTest = cluster.getMap("ttl-test");

        HashMap<Long, Boolean> putAll = new HashMap<Long, Boolean>();
        putAll.put(1l, true);
        putAll.put(2l, false);
        clusterTtlTest.putAll(putAll);

        clusterTtlTest.put(3l, true);

        clusterTtlTest.put(4l, true, 5, TimeUnit.SECONDS);

        Thread.sleep(10000);

        System.out.println("Still Exists? - PutAll: " + clusterTtlTest.containsKey(1l) + ", Put: " + clusterTtlTest.containsKey(3l) + ",  PutWithTtl: " + clusterTtlTest.containsKey(4l));

        System.exit(0);
    }
}
@notz

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2013

Seems that this commit 8a53601 changed the behaviour how map.set works. And PutAllCallable uses ttl 0 - so no eviction.

notz added a commit to notz/hazelcast that referenced this issue Aug 13, 2013

notz added a commit to notz/hazelcast that referenced this issue Aug 14, 2013

@mdogan mdogan closed this in #671 Aug 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.