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

Near cache compatibility with 3.7 client is broken for TTL expirations #9674

Closed
ihsandemir opened this issue Jan 17, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@ihsandemir
Copy link
Contributor

commented Jan 17, 2017

The following client test fails if the client if 3.7.4 and when it is run against 3.8-SNAPSHOT server. It passes when both client and server are 3.8-SNAPSHOT or 3.7.4.

package com.hazelcast.client.map.impl.nearcache;

import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.NearCacheConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.test.AssertTask;
import com.hazelcast.test.HazelcastTestSupport;

import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

/**
 * Created by ihsan on 17/01/17.
 */
public class TTLTest {
    public static void main(String[] args) {
        int ttlTime = 2000; //msecs
        String mapName = "SomeMap";
        ClientConfig config = new ClientConfig();
        config.addNearCacheConfig(new NearCacheConfig(mapName));
        HazelcastInstance client = HazelcastClient.newHazelcastClient(config);
        final IMap<Object, Object> map = client.getMap(mapName);
        map.put(1, "value1", ttlTime, TimeUnit.MILLISECONDS);

        Object firstValue = map.get(1);
        System.out.println("First value:" + firstValue);
        assertEquals("value1", firstValue);

        try {
            Thread.sleep(ttlTime);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        // trigger eviction
        Object secondValue = map.get(1);
        System.out.println("Second value:" + secondValue);

        HazelcastTestSupport.assertTrueAllTheTime(new AssertTask() {
            @Override
            public void run()
                    throws Exception {
                Object value = map.get(1);
                System.out.println("Value is " + value);
                assertEquals("value1", value);
            }
        }, 20);

        System.out.println("Test finished");

        HazelcastClient.shutdownAll();
    }
}

@ihsandemir ihsandemir added this to the 3.8 milestone Jan 17, 2017

@ihsandemir

This comment has been minimized.

Copy link
Contributor Author

commented Jan 17, 2017

More info #9669

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Jan 19, 2017

hi @ihsandemir, do you know the root cause? Are you working on this?

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.