Search in sources :

Example 6 with PageLockTrackerManager

use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.

the class BPlusTreeSelfTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    stop.set(false);
    long seed = System.nanoTime();
    X.println("Test seed: " + seed + "L; // ");
    rnd = new Random(seed);
    pageMem = createPageMemory();
    reuseList = createReuseList(CACHE_ID, pageMem, 0, true);
    lockTrackerManager = new PageLockTrackerManager(log, "testTreeManager") {

        @Override
        public PageLockListener createPageLockTracker(String name) {
            return new TestPageLockListener(super.createPageLockTracker(name));
        }
    };
    lockTrackerManager.start();
}
Also used : Random(java.util.Random) GridRandom(org.apache.ignite.internal.util.GridRandom) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) PageLockListener(org.apache.ignite.internal.processors.cache.persistence.tree.util.PageLockListener) PageLockTrackerManager(org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager)

Example 7 with PageLockTrackerManager

use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.

the class LinkMapTest method test.

/**
 * Test that LinkMap works.
 * @throws Exception
 */
@Test
public void test() throws Exception {
    int cacheGroupId = 1;
    String groupName = "test";
    FullPageId pageId = new FullPageId(pageMem.allocatePage(cacheGroupId, 0, PageIdAllocator.FLAG_DATA), cacheGroupId);
    PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
    when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);
    LinkMap map = new LinkMap(cacheGroupId, groupName, pageMem, pageId.pageId(), true, pageLockTrackerManager);
    for (int i = 0; i < 10_000; i++) map.put(i, i + 1);
    for (int i = 0; i < 10_000; i++) assertEquals(i + 1, map.get(i));
}
Also used : ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) PageLockTrackerManager(org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager) FullPageId(org.apache.ignite.internal.pagemem.FullPageId) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

PageLockTrackerManager (org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager)7 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)2 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Random (java.util.Random)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)1 DataRegion (org.apache.ignite.internal.processors.cache.persistence.DataRegion)1 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)1 IndexStorageImpl (org.apache.ignite.internal.processors.cache.persistence.IndexStorageImpl)1 RootPage (org.apache.ignite.internal.processors.cache.persistence.RootPage)1 NoOpPageEvictionTracker (org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker)1 CacheFreeList (org.apache.ignite.internal.processors.cache.persistence.freelist.CacheFreeList)1 PageLockListener (org.apache.ignite.internal.processors.cache.persistence.tree.util.PageLockListener)1 GridMetricManager (org.apache.ignite.internal.processors.metric.GridMetricManager)1