2 Replies Latest reply: Aug 27, 2013 3:43 AM by 994868 RSS

    [Urgent] Bug found with coherence LimitFilters - Coherence 3.7.1.9

    994868

      Hi,

       

      We believe we have identified a serious bug with LimitFilters while using the Coherence Extend client (I am not sure if it only affects the extend client).

       

      The summary of the bug is that when using Integers as keys to a cache, we get different results as to when we use Strings, Double, etc, when the data is partitioned across two nodes. We do not get the correct results of the query.  Also of note is that this only happens when we provide a comparator.

       

      Steps to reproduce

       

      - Start up a distributed cache across two nodes.

      - Add data to the cache, a simplified example is a cache of Integers->Strings

      - See the test below

       

      Has anybody experienced this before?  I have tried to isolate the test case as much as possible but it could still be environment dependent.. any suggested workarounds that are not too much of a hack are appreciated! If we increase the page size, the problem seems to disappear.

       

      [code]

      @Test
        public void testStringCache() {
        NamedCache cache = CacheFactory.getCache(CoherenceCacheName.Product.getXmlName());
        cache.clear();
      
      
        productCache.put(Integer.valueOf(49355),""+49355);
        productCache.put(Integer.valueOf(49356),""+49356);
        productCache.put(Integer.valueOf(49357),""+49357);
        productCache.put(Integer.valueOf(49358),""+49358);
        productCache.put(Integer.valueOf(49362),""+49362);
        productCache.put(Integer.valueOf(49365),""+49365);
        productCache.put(Integer.valueOf(49366),""+49366);
        productCache.put(Integer.valueOf(49423),""+49423);
        productCache.put(Integer.valueOf(50284),""+50284);
        productCache.put(Integer.valueOf(59404),""+59404);
        productCache.put(Integer.valueOf(62897),""+62897);
        productCache.put(Integer.valueOf(63342),""+63342);
        productCache.put(Integer.valueOf(66133),""+66133);
        productCache.put(Integer.valueOf(68848),""+68848);
        productCache.put(Integer.valueOf(99861),""+99861);
        productCache.put(Integer.valueOf(326637),""+326637);
        productCache.put(Integer.valueOf(365149),""+365149);
        productCache.put(Integer.valueOf(366043),""+366043);
        productCache.put(Integer.valueOf(366569),""+366569);
      
      
      
        Filter productCacheFilter = new AlwaysFilter();
      
      
        int pageSize = 20;
      
        LimitFilter limitedFilter = new LimitFilter(productCacheFilter, pageSize);
        limitedFilter.setPage(0); //limitfilter is zero based.
      
        Set<Map.Entry<Integer, ? extends IProduct>> products =productCache.entrySet(limitedFilter, new ReflectionExtractor("toString")); // the reflection extractor here is a comparator.
      
        Integer count = (Integer) productCache.aggregate(productCacheFilter,new Count());
        System.out.println("Count is "+count + "but products = "+products.size());
      
        }
      
      
      

      [/code]

       

      - If we change Integer to String/Double, the counts match (19/19). Otherwise the results are 19/17

      - Removing the comparator fixes the issue