Search in sources :

Example 11 with PageMemory

use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.

the class PageMemoryNoLoadSelfTest method testLoadedPagesCount.

/**
     * @throws Exception If failed.
     */
public void testLoadedPagesCount() throws Exception {
    PageMemory mem = memory();
    mem.start();
    int expPages = MAX_MEMORY_SIZE / mem.systemPageSize();
    try {
        for (int i = 0; i < expPages * 2; i++) allocatePage(mem);
    } catch (IgniteOutOfMemoryException e) {
        e.printStackTrace();
        // Expected.
        assertEquals(mem.loadedPages(), expPages);
    } finally {
        mem.stop();
    }
}
Also used : IgniteOutOfMemoryException(org.apache.ignite.internal.mem.IgniteOutOfMemoryException) PageMemory(org.apache.ignite.internal.pagemem.PageMemory)

Example 12 with PageMemory

use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.

the class PageMemoryNoLoadSelfTest method testPageTearingInner.

/**
     * @throws Exception If failed.
     */
public void testPageTearingInner() throws Exception {
    PageMemory mem = memory();
    mem.start();
    try {
        FullPageId fullId1 = allocatePage(mem);
        FullPageId fullId2 = allocatePage(mem);
        long page1 = mem.acquirePage(fullId1.cacheId(), fullId1.pageId());
        try {
            long page2 = mem.acquirePage(fullId2.cacheId(), fullId2.pageId());
            info("Allocated pages [page1Id=" + fullId1.pageId() + ", page1=" + page1 + ", page2Id=" + fullId2.pageId() + ", page2=" + page2 + ']');
            try {
                writePage(mem, fullId1.pageId(), page1, 1);
                writePage(mem, fullId2.pageId(), page2, 2);
                readPage(mem, fullId1.pageId(), page1, 1);
                readPage(mem, fullId2.pageId(), page2, 2);
                // Check read after read.
                readPage(mem, fullId1.pageId(), page1, 1);
                readPage(mem, fullId2.pageId(), page2, 2);
            } finally {
                mem.releasePage(fullId2.cacheId(), fullId2.pageId(), page2);
            }
        } finally {
            mem.releasePage(fullId1.cacheId(), fullId1.pageId(), page1);
        }
    } finally {
        mem.stop();
    }
}
Also used : PageMemory(org.apache.ignite.internal.pagemem.PageMemory) FullPageId(org.apache.ignite.internal.pagemem.FullPageId)

Example 13 with PageMemory

use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.

the class BPlusTreeSelfTest method createPageMemory.

/**
     * @return Page memory.
     */
protected PageMemory createPageMemory() throws Exception {
    MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(1024 * MB);
    PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
    pageMem.start();
    return pageMem;
}
Also used : PageMemoryNoStoreImpl(org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider) MemoryMetricsImpl(org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)

Example 14 with PageMemory

use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.

the class FreeListImplSelfTest method createPageMemory.

/**
     * @return Page memory.
     */
protected PageMemory createPageMemory(int pageSize, MemoryPolicyConfiguration plcCfg) throws Exception {
    PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, pageSize, plcCfg, new MemoryMetricsImpl(plcCfg), true);
    pageMem.start();
    return pageMem;
}
Also used : PageMemoryNoStoreImpl(org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider) MemoryMetricsImpl(org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)

Aggregations

PageMemory (org.apache.ignite.internal.pagemem.PageMemory)14 UnsafeMemoryProvider (org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)7 MemoryPolicyConfiguration (org.apache.ignite.configuration.MemoryPolicyConfiguration)6 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)6 MemoryMetricsImpl (org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)6 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 JavaLogger (org.apache.ignite.logger.java.JavaLogger)4 ArrayList (java.util.ArrayList)2 File (java.io.File)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)1 IgniteOutOfMemoryException (org.apache.ignite.internal.mem.IgniteOutOfMemoryException)1 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)1 MetadataStorage (org.apache.ignite.internal.processors.cache.database.MetadataStorage)1 RootPage (org.apache.ignite.internal.processors.cache.database.RootPage)1 FreeListImpl (org.apache.ignite.internal.processors.cache.database.freelist.FreeListImpl)1 Value (org.h2.value.Value)1