Search in sources :

Example 21 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.

the class IgniteWalRecoveryPPCTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME_1);
    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
    cfg.setCacheConfiguration(ccfg);
    CacheConfiguration<Integer, IndexedObject> ccfg2 = new CacheConfiguration<>(CACHE_NAME_2);
    ccfg2.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32));
    ccfg2.setDataRegionName(MEM_PLC_NO_PDS);
    cfg.setCacheConfiguration(ccfg, ccfg2);
    DataStorageConfiguration dbCfg = new DataStorageConfiguration();
    dbCfg.setPageSize(4 * 1024);
    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
    memPlcCfg.setInitialSize(1024 * 1024 * 1024);
    memPlcCfg.setMaxSize(1024 * 1024 * 1024);
    memPlcCfg.setPersistenceEnabled(true);
    dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);
    DataRegionConfiguration memPlcCfg2 = new DataRegionConfiguration();
    memPlcCfg2.setName(MEM_PLC_NO_PDS);
    memPlcCfg2.setInitialSize(1024 * 1024 * 1024);
    memPlcCfg2.setMaxSize(1024 * 1024 * 1024);
    memPlcCfg2.setPersistenceEnabled(false);
    dbCfg.setDataRegionConfigurations(memPlcCfg2);
    dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);
    dbCfg.setWalHistorySize(2);
    dbCfg.setWalMode(WALMode.LOG_ONLY);
    if (walSegmentSize != 0)
        dbCfg.setWalSegmentSize(walSegmentSize);
    cfg.setDataStorageConfiguration(dbCfg);
    cfg.setMarshaller(null);
    BinaryConfiguration binCfg = new BinaryConfiguration();
    binCfg.setCompactFooter(false);
    cfg.setBinaryConfiguration(binCfg);
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 22 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.

the class IgniteWalReaderTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(gridName);
    final CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME);
    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
    ccfg.setIndexedTypes(Integer.class, IndexedObject.class);
    cfg.setCacheConfiguration(ccfg);
    cfg.setIncludeEventTypes(EventType.EVT_WAL_SEGMENT_ARCHIVED);
    DataStorageConfiguration dsCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(1024 * 1024 * 1024).setPersistenceEnabled(true)).setPageSize(PAGE_SIZE).setWalHistorySize(1).setWalSegmentSize(1024 * 1024).setWalSegments(WAL_SEGMENTS).setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND);
    if (archiveIncompleteSegmentAfterInactivityMs > 0)
        dsCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs);
    final String workDir = U.defaultWorkDirectory();
    final File db = U.resolveWorkDirectory(workDir, DFLT_STORE_DIR, false);
    final File wal = new File(db, "wal");
    if (setWalAndArchiveToSameValue) {
        final String walAbsPath = wal.getAbsolutePath();
        dsCfg.setWalPath(walAbsPath);
        dsCfg.setWalArchivePath(walAbsPath);
    } else {
        dsCfg.setWalPath(wal.getAbsolutePath());
        dsCfg.setWalArchivePath(new File(wal, "archive").getAbsolutePath());
    }
    cfg.setDataStorageConfiguration(dsCfg);
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) File(java.io.File) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 23 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.

the class IgniteMetaStorageBasicTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    DataStorageConfiguration storageCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true)).setWalMode(WALMode.LOG_ONLY);
    cfg.setDataStorageConfiguration(storageCfg);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi);
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 24 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.

the class BPlusTreePageMemoryImplTest method createPageMemory.

/**
 * {@inheritDoc}
 */
@Override
protected PageMemory createPageMemory() throws Exception {
    long[] sizes = new long[CPUS + 1];
    for (int i = 0; i < sizes.length; i++) sizes[i] = 1024 * MB / CPUS;
    sizes[CPUS] = 10 * MB;
    DirectMemoryProvider provider = new UnsafeMemoryProvider(log);
    GridCacheSharedContext<Object, Object> sharedCtx = new GridCacheSharedContext<>(new GridTestKernalContext(log), null, null, null, new NoOpPageStoreManager(), new NoOpWALManager(), null, new IgniteCacheDatabaseSharedManager(), null, null, null, null, null, null, null, null);
    PageMemory mem = new PageMemoryImpl(provider, sizes, sharedCtx, PAGE_SIZE, (fullPageId, byteBuf, tag) -> {
        assert false : "No page replacement should happen during the test";
    }, new CIX3<Long, FullPageId, PageMemoryEx>() {

        @Override
        public void applyx(Long aLong, FullPageId fullPageId, PageMemoryEx ex) {
        }
    }, () -> true, new DataRegionMetricsImpl(new DataRegionConfiguration()), PageMemoryImpl.ThrottlingPolicy.DISABLED, null);
    mem.start();
    return mem;
}
Also used : GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) FullPageId(org.apache.ignite.internal.pagemem.FullPageId)

Example 25 with DataRegionConfiguration

use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.

the class BPlusTreeReuseListPageMemoryImplTest method createPageMemory.

/**
 * {@inheritDoc}
 */
@Override
protected PageMemory createPageMemory() throws Exception {
    long[] sizes = new long[CPUS + 1];
    for (int i = 0; i < sizes.length; i++) sizes[i] = 1024 * MB / CPUS;
    sizes[CPUS] = 10 * MB;
    DirectMemoryProvider provider = new UnsafeMemoryProvider(log);
    GridCacheSharedContext<Object, Object> sharedCtx = new GridCacheSharedContext<>(new GridTestKernalContext(log), null, null, null, new NoOpPageStoreManager(), new NoOpWALManager(), null, new IgniteCacheDatabaseSharedManager(), null, null, null, null, null, null, null, null);
    PageMemory mem = new PageMemoryImpl(provider, sizes, sharedCtx, PAGE_SIZE, (fullPageId, byteBuf, tag) -> {
        assert false : "No page replacement (rotation with disk) should happen during the test";
    }, new GridInClosure3X<Long, FullPageId, PageMemoryEx>() {

        @Override
        public void applyx(Long page, FullPageId fullPageId, PageMemoryEx pageMem) {
        }
    }, () -> true, new DataRegionMetricsImpl(new DataRegionConfiguration()), PageMemoryImpl.ThrottlingPolicy.DISABLED, null);
    mem.start();
    return mem;
}
Also used : GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) FullPageId(org.apache.ignite.internal.pagemem.FullPageId)

Aggregations

DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)147 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)119 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)108 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)48 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)45 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)33 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)16 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)15 UnsafeMemoryProvider (org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)10 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)9 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)8 File (java.io.File)7 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)5 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)5 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)5 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4