Sergey Chugunov created IGNITE-5950:
---------------------------------------

             Summary: Incorrect assertion for cache size
                 Key: IGNITE-5950
                 URL: https://issues.apache.org/jira/browse/IGNITE-5950
             Project: Ignite
          Issue Type: Bug
          Components: persistence
    Affects Versions: 2.1
            Reporter: Sergey Chugunov
            Assignee: Sergey Chugunov
            Priority: Critical
             Fix For: 2.2


*PagePartitionCountersIO::readCacheSizes* incorrectly asserts cache size:

{noformat}
public boolean readCacheSizes(long pageAddr, Map<Integer, Long> res) {
        int cnt = getCount(pageAddr);

        assert cnt >= 0 && cnt <= Short.MAX_VALUE : cnt;

        if (cnt == 0)
            return true;

        int off = ITEMS_OFF;

        for (int i = 0; i < cnt; i++) {
            int cacheId = PageUtils.getInt(pageAddr, off);
            off += 4;

            assert cacheId != 0;

            long cacheSize = PageUtils.getLong(pageAddr, off);
            off += 8;

            assert cacheSize > 0 : cacheSize; //WRONG assertion! cache of zero 
size if totally legal

            Long old = res.put(cacheId, cacheSize);

            assert old == null;
        }

        return getLastFlag(pageAddr);
    }
{noformat}

Correct assertion is {{cacheSize >= 0}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to