Aleksey Plekhanov created IGNITE-25766:
------------------------------------------

             Summary: Incorrect metric value TotalAllocatedPages for in-memory 
cache groups
                 Key: IGNITE-25766
                 URL: https://issues.apache.org/jira/browse/IGNITE-25766
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov


Metric {{TotalAllocatedPages}} was introduced by IGNITE-14774, but value of 
this metric is incorrect:
{noformat}
    public void testTotalAllocatedPagesForInMemoryCacheGroups() throws 
Exception {
        IgniteEx ignite = startGrid(0);

        IgniteCache<Integer, byte[]> cache1 = ignite.createCache("cache1");
        IgniteCache<Integer, byte[]> cache2 = ignite.createCache("cache2");
        IgniteCache<Integer, byte[]> cache3 = ignite.createCache("cache3");

        for (int i = 0; i < 1000; i++) {
            cache1.put(i, new byte[200]);
            cache2.put(i, new byte[3700]);
        }

        CacheGroupContext grp1 = 
ignite.cachex(cache1.getName()).context().group();
        CacheGroupContext grp2 = 
ignite.cachex(cache2.getName()).context().group();
        CacheGroupContext grp3 = 
ignite.cachex(cache3.getName()).context().group();

        assertTrue(grp1.metrics().getTotalAllocatedPages() < 
grp2.metrics().getTotalAllocatedPages());
        assertEquals(0, grp3.metrics().getTotalAllocatedPages());
    }
{noformat}

Metric was added without any tests. Wrong metric result confuses users. 
Moreover, it's impossible to calculate such a metric, since in in-memory mode 
one data page can contain data for different cache groups and there are data 
structures exist, which shared accross different caches (page lists, for 
example).
Perhaps it worth to set this metric to 0. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to