Search in sources :

Example 1 with PageIoRegistry

use of org.apache.ignite.internal.pagememory.io.PageIoRegistry in project ignite-3 by apache.

the class PageMemoryNoLoadSelfTest method memory.

/**
 * Creates new page memory instance.
 *
 * @return Page memory implementation.
 * @throws Exception If failed.
 */
protected PageMemory memory() throws Exception {
    dataRegionCfg.change(cfg -> cfg.convert(PageMemoryDataRegionChange.class).changePageSize(PAGE_SIZE).changeInitSize(MAX_MEMORY_SIZE).changeMaxSize(MAX_MEMORY_SIZE)).get(1, SECONDS);
    DirectMemoryProvider provider = new UnsafeMemoryProvider(null);
    PageIoRegistry ioRegistry = new PageIoRegistry();
    ioRegistry.loadFromServiceLoader();
    return new PageMemoryNoStoreImpl(provider, (PageMemoryDataRegionConfiguration) fixConfiguration(dataRegionCfg), ioRegistry);
}
Also used : Assertions.fail(org.junit.jupiter.api.Assertions.fail) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) PageMemory(org.apache.ignite.internal.pagememory.PageMemory) DirectMemoryProvider(org.apache.ignite.internal.pagememory.mem.DirectMemoryProvider) PageIoRegistry(org.apache.ignite.internal.pagememory.io.PageIoRegistry) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) PageMemoryDataRegionConfigurationSchema(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema) FullPageId(org.apache.ignite.internal.pagememory.FullPageId) PageIdAllocator(org.apache.ignite.internal.pagememory.PageIdAllocator) ArrayList(java.util.ArrayList) InjectConfiguration(org.apache.ignite.internal.configuration.testframework.InjectConfiguration) TestPageIo(org.apache.ignite.internal.pagememory.TestPageIoModule.TestPageIo) HashSet(java.util.HashSet) IgniteOutOfMemoryException(org.apache.ignite.internal.pagememory.mem.IgniteOutOfMemoryException) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) UnsafeMemoryAllocatorConfigurationSchema(org.apache.ignite.configuration.schemas.store.UnsafeMemoryAllocatorConfigurationSchema) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) ConfigurationExtension(org.apache.ignite.internal.configuration.testframework.ConfigurationExtension) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider) DataRegionConfiguration(org.apache.ignite.configuration.schemas.store.DataRegionConfiguration) Collection(java.util.Collection) PageIo(org.apache.ignite.internal.pagememory.io.PageIo) Assertions.assertNotSame(org.junit.jupiter.api.Assertions.assertNotSame) BaseIgniteAbstractTest(org.apache.ignite.internal.testframework.BaseIgniteAbstractTest) PageUtils(org.apache.ignite.internal.pagememory.util.PageUtils) ConfigurationTestUtils.fixConfiguration(org.apache.ignite.internal.configuration.ConfigurationTestUtils.fixConfiguration) Test(org.junit.jupiter.api.Test) List(java.util.List) IgniteInternalCheckedException(org.apache.ignite.lang.IgniteInternalCheckedException) PageIdUtils(org.apache.ignite.internal.pagememory.util.PageIdUtils) PageMemoryDataRegionConfiguration(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfiguration) SECONDS(java.util.concurrent.TimeUnit.SECONDS) DirectMemoryProvider(org.apache.ignite.internal.pagememory.mem.DirectMemoryProvider) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider) PageIoRegistry(org.apache.ignite.internal.pagememory.io.PageIoRegistry)

Example 2 with PageIoRegistry

use of org.apache.ignite.internal.pagememory.io.PageIoRegistry in project ignite-3 by apache.

the class PageMemoryImplNoLoadTest method memory.

/**
 * {@inheritDoc}
 */
@Override
protected PageMemory memory() throws Exception {
    dataRegionCfg.change(cfg -> cfg.convert(PageMemoryDataRegionChange.class).changePageSize(PAGE_SIZE).changeInitSize(MAX_MEMORY_SIZE).changeMaxSize(MAX_MEMORY_SIZE)).get(1, SECONDS);
    PageIoRegistry ioRegistry = new PageIoRegistry();
    ioRegistry.loadFromServiceLoader();
    return new PageMemoryImpl(new UnsafeMemoryProvider(null), (PageMemoryDataRegionConfiguration) fixConfiguration(dataRegionCfg), ioRegistry, LongStream.range(0, 10).map(i -> 5 * MiB).toArray(), new TestPageReadWriteManager(), (page, fullPageId, pageMemoryEx) -> {
    });
}
Also used : ConfigurationTestUtils.fixConfiguration(org.apache.ignite.internal.configuration.ConfigurationTestUtils.fixConfiguration) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider) Test(org.junit.jupiter.api.Test) PageMemory(org.apache.ignite.internal.pagememory.PageMemory) LongStream(java.util.stream.LongStream) PageIoRegistry(org.apache.ignite.internal.pagememory.io.PageIoRegistry) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) MiB(org.apache.ignite.internal.util.Constants.MiB) PageMemoryDataRegionConfiguration(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfiguration) SECONDS(java.util.concurrent.TimeUnit.SECONDS) PageMemoryNoLoadSelfTest(org.apache.ignite.internal.pagememory.impl.PageMemoryNoLoadSelfTest) PageMemoryDataRegionChange(org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange) PageIoRegistry(org.apache.ignite.internal.pagememory.io.PageIoRegistry) UnsafeMemoryProvider(org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider)

Aggregations

SECONDS (java.util.concurrent.TimeUnit.SECONDS)2 PageMemoryDataRegionChange (org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionChange)2 PageMemoryDataRegionConfiguration (org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfiguration)2 ConfigurationTestUtils.fixConfiguration (org.apache.ignite.internal.configuration.ConfigurationTestUtils.fixConfiguration)2 PageMemory (org.apache.ignite.internal.pagememory.PageMemory)2 PageIoRegistry (org.apache.ignite.internal.pagememory.io.PageIoRegistry)2 UnsafeMemoryProvider (org.apache.ignite.internal.pagememory.mem.unsafe.UnsafeMemoryProvider)2 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 LongStream (java.util.stream.LongStream)1 DataRegionConfiguration (org.apache.ignite.configuration.schemas.store.DataRegionConfiguration)1 PageMemoryDataRegionConfigurationSchema (org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema)1 UnsafeMemoryAllocatorConfigurationSchema (org.apache.ignite.configuration.schemas.store.UnsafeMemoryAllocatorConfigurationSchema)1 ConfigurationExtension (org.apache.ignite.internal.configuration.testframework.ConfigurationExtension)1 InjectConfiguration (org.apache.ignite.internal.configuration.testframework.InjectConfiguration)1 FullPageId (org.apache.ignite.internal.pagememory.FullPageId)1 PageIdAllocator (org.apache.ignite.internal.pagememory.PageIdAllocator)1