Noam Liran created IGNITE-2526:
---------------------------------- Summary: get() from a REPLICATED cache for a non-existing key on a non-primary node causes a get() to the primary node Key: IGNITE-2526 URL: https://issues.apache.org/jira/browse/IGNITE-2526 Project: Ignite Issue Type: Bug Components: cache Affects Versions: 1.5.0.final Reporter: Noam Liran {code} import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.Ignition; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cache.affinity.Affinity; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.lang.IgniteUuid; public class Main { private static CacheConfiguration<Object, Object> CACHE_CONFIG = new CacheConfiguration<>() .setName("test") .setCacheMode(CacheMode.REPLICATED); static { CACHE_CONFIG.setStatisticsEnabled(true); } private static Object getKeyInNode(Ignite ignite) { Affinity<Object> affinity = ignite.affinity(CACHE_CONFIG.getName()); IgniteUuid uuid = IgniteUuid.randomUuid(); while (!affinity.isPrimary(ignite.cluster().localNode(), uuid)) { uuid = IgniteUuid.randomUuid(); } return uuid; } public static void main(String[] args) throws InterruptedException { Ignite ignite1 = Ignition.start(new IgniteConfiguration().setGridName("1")); Ignite ignite2 = Ignition.start(new IgniteConfiguration().setGridName("2")); Ignite ignite3 = Ignition.start(new IgniteConfiguration().setGridName("3")); IgniteCache<Object, Object> cache1 = ignite1.getOrCreateCache(CACHE_CONFIG); IgniteCache<Object, Object> cache2 = ignite2.getOrCreateCache(CACHE_CONFIG); IgniteCache<Object, Object> cache3 = ignite3.getOrCreateCache(CACHE_CONFIG); Thread.sleep(3_000); Object cache2Key = getKeyInNode(ignite2); System.out.printf("initial: cache1gets:%d cache2gets:%d cache3gets:%d\n", cache1.metrics().getCacheGets(), cache2.metrics().getCacheGets(), cache3.metrics().getCacheGets()); cache1.get(cache2Key); cache3.get(cache2Key); System.out.printf("status: cache1gets:%d cache2gets:%d cache3gets:%d\n", cache1.metrics().getCacheGets(), cache2.metrics().getCacheGets(), cache3.metrics().getCacheGets()); System.out.printf("expected: cache1gets:1 cache2gets:0 cache3gets:1\n"); Ignition.stopAll(false); } } {code} Output: {noformat} initial: cache1gets:0 cache2gets:0 cache3gets:0 status: cache1gets:0 cache2gets:2 cache3gets:0 expected: cache1gets:1 cache2gets:0 cache3gets:1 {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) |
Free forum by Nabble | Edit this page |