Search in sources :

Example 6 with UnsafeMemoryProvider

use of org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider in project ignite-3 by apache.

the class ItBplusTreeReuseListPageMemoryImplTest method createPageMemory.

/**
 * {@inheritDoc}
 */
@Override
protected PageMemory createPageMemory() throws Exception {
    dataRegionCfg.change(c -> c.convert(PageMemoryDataRegionChange.class).changePageSize(PAGE_SIZE).changeInitSize(MAX_MEMORY_SIZE).changeMaxSize(MAX_MEMORY_SIZE)).get(1, TimeUnit.SECONDS);
    long[] sizes = LongStream.range(0, CPUS + 1).map(i -> MAX_MEMORY_SIZE / CPUS).toArray();
    sizes[CPUS] = 10 * MiB;
    TestPageIoRegistry ioRegistry = new TestPageIoRegistry();
    ioRegistry.loadFromServiceLoader();
    return new PageMemoryImpl(new UnsafeMemoryProvider(null), (PageMemoryDataRegionConfiguration) fixConfiguration(dataRegionCfg), ioRegistry, sizes, new TestPageReadWriteManager(), (page, fullPageId, pageMemoryEx) -> {
    });
}
Also used : ConfigurationTestUtils.fixConfiguration(org.apache.ignite.internal.configuration.ConfigurationTestUtils.fixConfiguration) TimeUnit(java.util.concurrent.TimeUnit) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider) PageMemory(org.apache.ignite.internal.pagememory.PageMemory) TestPageIoRegistry(org.apache.ignite.internal.pagememory.TestPageIoRegistry) LongStream(java.util.stream.LongStream) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) MiB(org.apache.ignite.internal.util.Constants.MiB) PageMemoryDataRegionConfiguration(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfiguration) ItBplusTreeReuseSelfTest(org.apache.ignite.internal.pagememory.tree.ItBplusTreeReuseSelfTest) TestPageIoRegistry(org.apache.ignite.internal.pagememory.TestPageIoRegistry) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider)

Example 7 with UnsafeMemoryProvider

use of org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider in project ignite-3 by apache.

the class ItBplusTreeReplaceRemoveRaceTest method createPageMemory.

protected PageMemory createPageMemory() throws Exception {
    dataRegionCfg.change(c -> c.convert(PageMemoryDataRegionChange.class).changePageSize(512).changeInitSize(1024 * MiB).changeMaxSize(1024 * MiB)).get(1, TimeUnit.SECONDS);
    TestPageIoRegistry ioRegistry = new TestPageIoRegistry();
    ioRegistry.loadFromServiceLoader();
    return new PageMemoryNoStoreImpl(new UnsafeMemoryProvider(null), (PageMemoryDataRegionConfiguration) fixConfiguration(dataRegionCfg), ioRegistry);
}
Also used : PageMemory(org.apache.ignite.internal.pagememory.PageMemory) BeforeEach(org.junit.jupiter.api.BeforeEach) TestPageIoRegistry(org.apache.ignite.internal.pagememory.TestPageIoRegistry) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) PageMemoryDataRegionConfigurationSchema(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema) IgniteTestUtils.runAsync(org.apache.ignite.internal.testframework.IgniteTestUtils.runAsync) CompletableFuture(java.util.concurrent.CompletableFuture) FullPageId(org.apache.ignite.internal.pagememory.FullPageId) BplusIo(org.apache.ignite.internal.pagememory.tree.io.BplusIo) FLAG_AUX(org.apache.ignite.internal.pagememory.PageIdAllocator.FLAG_AUX) InjectConfiguration(org.apache.ignite.internal.configuration.testframework.InjectConfiguration) PageLockListenerNoOp(org.apache.ignite.internal.pagememory.util.PageLockListenerNoOp) UnsafeMemoryAllocatorConfigurationSchema(org.apache.ignite.configuration.schemas.store.UnsafeMemoryAllocatorConfigurationSchema) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) ConfigurationExtension(org.apache.ignite.internal.configuration.testframework.ConfigurationExtension) PageMemoryNoStoreImpl(org.apache.ignite.internal.pagememory.impl.PageMemoryNoStoreImpl) BplusLeafIo(org.apache.ignite.internal.pagememory.tree.io.BplusLeafIo) PageUtils.putInt(org.apache.ignite.internal.pagememory.util.PageUtils.putInt) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider) CyclicBarrier(java.util.concurrent.CyclicBarrier) Externalizable(java.io.Externalizable) DataRegionConfiguration(org.apache.ignite.configuration.schemas.store.DataRegionConfiguration) BplusMetaIo(org.apache.ignite.internal.pagememory.tree.io.BplusMetaIo) BplusInnerIo(org.apache.ignite.internal.pagememory.tree.io.BplusInnerIo) BaseIgniteAbstractTest(org.apache.ignite.internal.testframework.BaseIgniteAbstractTest) PageUtils(org.apache.ignite.internal.pagememory.util.PageUtils) IgniteBiTuple(org.apache.ignite.lang.IgniteBiTuple) ConfigurationTestUtils.fixConfiguration(org.apache.ignite.internal.configuration.ConfigurationTestUtils.fixConfiguration) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) AtomicLong(java.util.concurrent.atomic.AtomicLong) Nullable(org.jetbrains.annotations.Nullable) INDEX_PARTITION(org.apache.ignite.internal.pagememory.PageIdAllocator.INDEX_PARTITION) IgniteInternalCheckedException(org.apache.ignite.lang.IgniteInternalCheckedException) AfterEach(org.junit.jupiter.api.AfterEach) IoVersions(org.apache.ignite.internal.pagememory.io.IoVersions) MiB(org.apache.ignite.internal.util.Constants.MiB) PageMemoryDataRegionConfiguration(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfiguration) PageMemoryNoStoreImpl(org.apache.ignite.internal.pagememory.impl.PageMemoryNoStoreImpl) TestPageIoRegistry(org.apache.ignite.internal.pagememory.TestPageIoRegistry) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider)

Aggregations

PageMemoryDataRegionChange (org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange)7 PageMemoryDataRegionConfiguration (org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfiguration)7 ConfigurationTestUtils.fixConfiguration (org.apache.ignite.internal.configuration.ConfigurationTestUtils.fixConfiguration)7 PageMemory (org.apache.ignite.internal.pagememory.PageMemory)7 UnsafeMemoryProvider (org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider)7 TimeUnit (java.util.concurrent.TimeUnit)5 TestPageIoRegistry (org.apache.ignite.internal.pagememory.TestPageIoRegistry)5 MiB (org.apache.ignite.internal.util.Constants.MiB)5 DataRegionConfiguration (org.apache.ignite.configuration.schemas.store.DataRegionConfiguration)4 PageMemoryDataRegionConfigurationSchema (org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema)4 UnsafeMemoryAllocatorConfigurationSchema (org.apache.ignite.configuration.schemas.store.UnsafeMemoryAllocatorConfigurationSchema)4 ConfigurationExtension (org.apache.ignite.internal.configuration.testframework.ConfigurationExtension)4 InjectConfiguration (org.apache.ignite.internal.configuration.testframework.InjectConfiguration)4 BaseIgniteAbstractTest (org.apache.ignite.internal.testframework.BaseIgniteAbstractTest)4 IgniteInternalCheckedException (org.apache.ignite.lang.IgniteInternalCheckedException)4 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Test (org.junit.jupiter.api.Test)4 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3