Java Code Examples for org.apache.ignite.configuration.DataStorageConfiguration#setDefaultDataRegionConfiguration()

The following examples show how to use org.apache.ignite.configuration.DataStorageConfiguration#setDefaultDataRegionConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheWithDifferentDataRegionConfigurationTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** Start node from builder */
public IgniteEx start() throws Exception {
    IgniteConfiguration cfg = getConfiguration(gridName);

    cfg.setConsistentId(gridName);

    DataStorageConfiguration storageCfg = new DataStorageConfiguration();
    storageCfg.setDataRegionConfigurations(regions.toArray(new DataRegionConfiguration[regions.size()]));
    cfg.setDataStorageConfiguration(storageCfg);

    if (dfltRegionConfiguration != null)
        storageCfg.setDefaultDataRegionConfiguration(dfltRegionConfiguration);

    cfg.setCacheConfiguration(caches.toArray(new CacheConfiguration[caches.size()]));

    return startGrid(cfg);
}
 
Example 2
Source File: StandaloneGridKernalContext.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @return Ignite configuration which allows to start requied processors for WAL reader
 */
protected IgniteConfiguration prepareIgniteConfiguration() {
    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setDiscoverySpi(new StandaloneNoopDiscoverySpi());
    cfg.setCommunicationSpi(new StandaloneNoopCommunicationSpi());

    final Marshaller marshaller = new BinaryMarshaller();
    cfg.setMarshaller(marshaller);

    final DataStorageConfiguration pstCfg = new DataStorageConfiguration();
    final DataRegionConfiguration regCfg = new DataRegionConfiguration();
    regCfg.setPersistenceEnabled(true);
    pstCfg.setDefaultDataRegionConfiguration(regCfg);

    cfg.setDataStorageConfiguration(pstCfg);

    marshaller.setContext(marshallerCtx);

    cfg.setMetricExporterSpi(new NoopMetricExporterSpi());
    cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi());

    return cfg;
}
 
Example 3
Source File: SystemWorkersTerminationTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setFailureHandler(new TestFailureHandler());

    DataRegionConfiguration drCfg = new DataRegionConfiguration();
    drCfg.setPersistenceEnabled(true);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();
    dsCfg.setDefaultDataRegionConfiguration(drCfg);
    dsCfg.setWalCompactionEnabled(true);

    cfg.setDataStorageConfiguration(dsCfg);

    return cfg;
}
 
Example 4
Source File: IgniteCheckClusterStateBeforeExecuteQueryTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

    pCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
        .setPersistenceEnabled(true)
        .setMaxSize(100L * 1024 * 1024));

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 5
Source File: IgniteCheckpointDirtyPagesForLowLoadTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    List<CacheConfiguration> ccfgs = new ArrayList<>();

    for (int g = 0; g < GROUPS; g++) {
        for (int i = 0; i < CACHES_IN_GRP; i++) {
            CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>().setName("dummyCache" + i + "." + g)
                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
                .setGroupName("dummyGroup" + g)
                .setAffinity(new RendezvousAffinityFunction(false, PARTS));

            ccfgs.add(ccfg);
        }
    }
    cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();
    dsCfg.setDefaultDataRegionConfiguration(
        new DataRegionConfiguration()
            .setPersistenceEnabled(true)
            .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)
    );
    dsCfg.setCheckpointFrequency(500);
    dsCfg.setWalMode(WALMode.LOG_ONLY);
    dsCfg.setWalHistorySize(1);

    cfg.setDataStorageConfiguration(dsCfg);

    return cfg;
}
 
Example 6
Source File: IgniteDbMemoryLeakAbstractTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected void configure(DataStorageConfiguration mCfg) {
    mCfg.setConcurrencyLevel(CONCURRENCY_LEVEL);

    long size = (1024 * (isLargePage() ? 16 : 4) + 24) * pagesMax();

    mCfg.setDefaultDataRegionConfiguration(
        new DataRegionConfiguration().setMaxSize(Math.max(size, MIN_PAGE_CACHE_SIZE)).setName("default"));
}
 
Example 7
Source File: CachePartitionLossWithRestartsTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setActiveOnStart(false);

    cfg.setConsistentId(igniteInstanceName);

    if (getTestIgniteInstanceIndex(igniteInstanceName) == clientIdx)
        cfg.setClientMode(true);

    cfg.setIncludeEventTypes(EventType.EVTS_ALL);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();
    dsCfg.setWalSegmentSize(4 * 1024 * 1024);
    dsCfg.setWalMode(WALMode.LOG_ONLY);

    final int size = 50 * 1024 * 1024;

    DataRegionConfiguration dfltRegCfg = new DataRegionConfiguration();
    dfltRegCfg.setName(DEFAULT_CACHE_NAME).setInitialSize(size).setMaxSize(size).setPersistenceEnabled(dfltRegionPersistence);

    dsCfg.setDefaultDataRegionConfiguration(dfltRegCfg);

    cfg.setDataStorageConfiguration(dsCfg);

    // Do not start cache on non-affinity node.
    CacheConfiguration ccfg = defaultCacheConfiguration().setNearConfiguration(null).
            setNodeFilter(new AttributeNodeFilter(START_CACHE_ATTR, Boolean.TRUE)).
            setBackups(0).
            setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT));

    if (mvccEnabled)
        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);

    if (startClientCache)
        cfg.setCacheConfiguration(ccfg);

    if (getTestIgniteInstanceIndex(igniteInstanceName) != nonAffIdx) {
        cfg.setUserAttributes(F.asMap(START_CACHE_ATTR, Boolean.TRUE));

        if (!startClientCache)
            cfg.setCacheConfiguration(ccfg);
    }

    return cfg;
}
 
Example 8
Source File: WalPathsTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param relativePath {@code True} - if wal archive path should be relative, {@code false} - for absolute path.
 * @return Ignite configuration with the same path to wal store and wal archive.
 * @throws Exception If failed.
 */
private IgniteConfiguration getConfig(boolean relativePath) throws Exception {
    IgniteConfiguration cfg = getConfiguration();

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();

    dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
        .setPersistenceEnabled(true)
        .setMaxSize(200 * 1024 * 1024));

    walDir = new File(U.defaultWorkDirectory(), getClass().getSimpleName());

    dsCfg.setWalPath(walDir.getAbsolutePath());
    dsCfg.setWalArchivePath(relativePath ? getClass().getSimpleName() : walDir.getAbsolutePath());

    cfg.setDataStorageConfiguration(dsCfg);

    return cfg;
}
 
Example 9
Source File: GridActivateExtensionTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setConsistentId("ConsId" + (condId++));
    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(primaryIpFinder);

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

    pCfg.setStoragePath(testName + "/db");
    pCfg.setWalArchivePath(testName + "/db/wal/archive");
    pCfg.setWalPath(testName + "/db/wal");

    pCfg.setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(200L * 1024 * 1024).setPersistenceEnabled(true));

    pCfg.setWalMode(WALMode.LOG_ONLY);

    pCfg.setPageSize(1024);
    pCfg.setConcurrencyLevel(64);

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 10
Source File: CacheMvccConfigurationValidationTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@SuppressWarnings("ThrowableNotThrown")
@Test
public void testNodeRestartWithCacheModeChangedMvccToTx() throws Exception {
    cleanPersistenceDir();

    //Enable persistence.
    DataStorageConfiguration storageCfg = new DataStorageConfiguration();
    DataRegionConfiguration regionCfg = new DataRegionConfiguration();
    regionCfg.setPersistenceEnabled(true);
    regionCfg.setPageEvictionMode(RANDOM_LRU);
    storageCfg.setDefaultDataRegionConfiguration(regionCfg);
    IgniteConfiguration cfg = getConfiguration("testGrid");
    cfg.setDataStorageConfiguration(storageCfg);
    cfg.setConsistentId(cfg.getIgniteInstanceName());

    Ignite node = startGrid(cfg);

    node.cluster().active(true);

    CacheConfiguration ccfg1 = new CacheConfiguration("test1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT);

    IgniteCache cache = node.createCache(ccfg1);

    cache.put(1, 1);
    cache.put(1, 2);
    cache.put(2, 2);

    stopGrid(cfg.getIgniteInstanceName());

    CacheConfiguration ccfg2 = new CacheConfiguration().setName(ccfg1.getName())
        .setAtomicityMode(TRANSACTIONAL);

    IgniteConfiguration cfg2 = getConfiguration("testGrid")
        .setConsistentId(cfg.getIgniteInstanceName())
        .setCacheConfiguration(ccfg2)
        .setDataStorageConfiguration(storageCfg);

    GridTestUtils.assertThrows(log, new Callable<Void>() {
        @Override public Void call() throws Exception {
            startGrid(cfg2);

            return null;
        }
    }, IgniteCheckedException.class, "Cannot start cache. Statically configured atomicity mode");
}
 
Example 11
Source File: CacheDataRegionConfigurationTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Verifies that warning is printed out to logs if after removing nodes from baseline
 * some caches reach or cross dangerous limit of metainformation overhead per data region.
 *
 * @throws Exception If failed.
 */
@Test
public void testWarningOnBaselineTopologyChange() throws Exception {
    DataRegionConfiguration defaultRegionCfg = new DataRegionConfiguration();
    defaultRegionCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
    defaultRegionCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
    defaultRegionCfg.setPersistenceEnabled(true);

    memCfg = new DataStorageConfiguration();
    memCfg.setDefaultDataRegionConfiguration(defaultRegionCfg);
    //one hour to guarantee that checkpoint will be triggered by 'dirty pages amount' trigger
    memCfg.setCheckpointFrequency(60 * 60 * 1000);

    ListeningTestLogger srv0Logger = new ListeningTestLogger(false, null);
    LogListener cacheGrpLsnr0 = matches("Cache group 'default' brings high overhead").build();
    srv0Logger.registerListener(cacheGrpLsnr0);
    logger = srv0Logger;

    IgniteEx ignite0 = startGrid("srv0");

    ListeningTestLogger srv1Logger = new ListeningTestLogger(false, null);
    LogListener cacheGrpLsnr1 = matches("Cache group 'default' brings high overhead").build();
    srv1Logger.registerListener(cacheGrpLsnr1);
    logger = srv1Logger;

    startGrid("srv1");

    ignite0.cluster().active(true);

    ignite0.createCache(
        new CacheConfiguration<>(DEFAULT_CACHE_NAME)
            .setDataRegionName(defaultRegionCfg.getName())
            .setCacheMode(CacheMode.PARTITIONED)
            .setAffinity(new RendezvousAffinityFunction(false, 512))
    );

    assertFalse(cacheGrpLsnr0.check());
    assertFalse(cacheGrpLsnr1.check());

    stopGrid("srv1");

    ignite0.cluster().baselineAutoAdjustEnabled(false);

    long topVer = ignite0.cluster().topologyVersion();

    ignite0.cluster().setBaselineTopology(topVer);

    awaitPartitionMapExchange();

    assertTrue(cacheGrpLsnr0.check());
}
 
Example 12
Source File: CacheDataRegionConfigurationTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Verifies that warning message is printed to the logs if user tries to start a static cache in data region which
 * overhead (e.g. metapages for partitions) occupies more space of the region than a defined threshold (15%)
 *
 * @throws Exception If failed.
 */
@Test
public void testWarningIfStaticCacheOverheadExceedsThreshold() throws Exception {
    DataRegionConfiguration smallRegionCfg = new DataRegionConfiguration();
    int numOfPartitions = 512;
    int partitionsMetaMemoryChunk = U.sizeInMegabytes(512 * DFLT_PAGE_SIZE);

    smallRegionCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
    smallRegionCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
    smallRegionCfg.setPersistenceEnabled(true);
    smallRegionCfg.setName("smallRegion");

    memCfg = new DataStorageConfiguration();
    memCfg.setDefaultDataRegionConfiguration(smallRegionCfg);
    //one hour to guarantee that checkpoint will be triggered by 'dirty pages amount' trigger
    memCfg.setCheckpointFrequency(60 * 60 * 1000);

    CacheConfiguration<Object, Object> manyPartitionsCache = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    //512 partitions are enough only if primary and backups count
    manyPartitionsCache.setAffinity(new RendezvousAffinityFunction(false, numOfPartitions));
    manyPartitionsCache.setBackups(1);

    ccfg = manyPartitionsCache;

    ListeningTestLogger srv0Logger = new ListeningTestLogger(false, null);
    LogListener cacheGrpLsnr0 = matches("Cache group 'default' brings high overhead").build();
    LogListener dataRegLsnr0 = matches("metainformation in data region 'smallRegion'").build();
    LogListener partsInfoLsnr0 = matches(numOfPartitions + " partitions, " +
        DFLT_PAGE_SIZE +
        " bytes per partition, " + partitionsMetaMemoryChunk + " MBs total").build();
    srv0Logger.registerAllListeners(cacheGrpLsnr0, dataRegLsnr0, partsInfoLsnr0);
    logger = srv0Logger;

    IgniteEx ignite0 = startGrid("srv0");

    ListeningTestLogger srv1Logger = new ListeningTestLogger(false, null);
    LogListener cacheGrpLsnr1 = matches("Cache group 'default' brings high overhead").build();
    LogListener dataRegLsnr1 = matches("metainformation in data region 'smallRegion'").build();
    LogListener partsInfoLsnr1 = matches(numOfPartitions + " partitions, " +
        DFLT_PAGE_SIZE +
        " bytes per partition, " + partitionsMetaMemoryChunk + " MBs total").build();
    srv1Logger.registerAllListeners(cacheGrpLsnr1, dataRegLsnr1, partsInfoLsnr1);
    logger = srv1Logger;

    startGrid("srv1");

    ignite0.cluster().active(true);

    //srv0 and srv1 print warning into the log as the threshold for cache in default cache group is broken
    assertTrue(cacheGrpLsnr0.check());
    assertTrue(dataRegLsnr0.check());
    assertTrue(partsInfoLsnr0.check());

    assertTrue(cacheGrpLsnr1.check());
    assertTrue(dataRegLsnr1.check());
    assertTrue(partsInfoLsnr1.check());
}
 
Example 13
Source File: CacheJdbcPojoWriteBehindStoreWithCoalescingTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** */
public DataStorageConfiguration getDataStorageConfiguration() {
    DataStorageConfiguration memCfg = new DataStorageConfiguration();

    DataRegionConfiguration plc = new DataRegionConfiguration();

    plc.setName("Default_Region");

    plc.setPageEvictionMode(RANDOM_LRU);

    if (isSmallRegion)
        plc.setMaxSize(128L * 1024 * 1024); // 128 MB
    else
        plc.setMaxSize(1L * 1024 * 1024 * 1024); // 1GB

    memCfg.setDefaultDataRegionConfiguration(plc);

    memCfg.setWalMode(LOG_ONLY);

    return memCfg;
}
 
Example 14
Source File: GridMarshallerMappingConsistencyTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration igniteCfg = super.getConfiguration(igniteInstanceName);

    igniteCfg.setConsistentId(igniteInstanceName);

    DataRegionConfiguration drCfg = new DataRegionConfiguration();
    drCfg.setPersistenceEnabled(true).setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();
    dsCfg.setDefaultDataRegionConfiguration(drCfg);

    igniteCfg.setDataStorageConfiguration(dsCfg);

    igniteCfg.setWorkDirectory(WORK_DIR + File.separator + igniteInstanceName);

    return igniteCfg;
}
 
Example 15
Source File: GridExchangeFreeSwitchTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();

    cfg.setCommunicationSpi(commSpi);

    cfg.setCacheConfiguration(cacheC != null ?
        cacheC.apply(igniteInstanceName) : new CacheConfiguration[] {cacheConfiguration()});

    cfg.setClusterStateOnStart(ClusterState.INACTIVE);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();

    DataRegionConfiguration drCfg = new DataRegionConfiguration();

    drCfg.setPersistenceEnabled(persistence);

    dsCfg.setDefaultDataRegionConfiguration(drCfg);

    cfg.setDataStorageConfiguration(dsCfg);

    return cfg;
}
 
Example 16
Source File: IgniteChangeGlobalStateAbstractTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param gridName Grid name.
 */
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(gridName);

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

    pCfg.setStoragePath(testName() + "/db");
    pCfg.setWalArchivePath(testName() + "/db/wal/archive");
    pCfg.setWalPath(testName() + "/db/wal");

    pCfg.setPageSize(1024);
    pCfg.setConcurrencyLevel(64);

    pCfg.setWalMode(WALMode.LOG_ONLY);

    pCfg.setDefaultDataRegionConfiguration(
        new DataRegionConfiguration().setMaxSize(200L * 1024 * 1024).setPersistenceEnabled(true));

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 17
Source File: IgnitePdsTransactionsHangTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    BinaryConfiguration binaryCfg = new BinaryConfiguration();
    binaryCfg.setCompactFooter(false);
    cfg.setBinaryConfiguration(binaryCfg);

    cfg.setPeerClassLoadingEnabled(true);

    TcpCommunicationSpi tcpCommSpi = new TcpCommunicationSpi();

    tcpCommSpi.setSharedMemoryPort(-1);
    cfg.setCommunicationSpi(tcpCommSpi);

    TransactionConfiguration txCfg = new TransactionConfiguration();

    txCfg.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);

    cfg.setTransactionConfiguration(txCfg);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setInitialSize(PAGE_CACHE_SIZE);
    memPlcCfg.setMaxSize(PAGE_CACHE_SIZE);
    memPlcCfg.setPersistenceEnabled(true);

    DataStorageConfiguration memCfg = new DataStorageConfiguration();

    memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
    memCfg.setWalHistorySize(1);
    memCfg.setCheckpointFrequency(CHECKPOINT_FREQUENCY);
    memCfg.setPageSize(PAGE_SIZE);

    cfg.setDataStorageConfiguration(memCfg);

    return cfg;
}
 
Example 18
Source File: IgniteWalRecoveryPPCTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@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(256L * 1024 * 1024);
    memPlcCfg.setMaxSize(256L * 1024 * 1024);
    memPlcCfg.setPersistenceEnabled(true);

    dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);

    DataRegionConfiguration memPlcCfg2 = new DataRegionConfiguration();
    memPlcCfg2.setName(MEM_PLC_NO_PDS);
    memPlcCfg2.setInitialSize(256L * 1024 * 1024);
    memPlcCfg2.setMaxSize(256L * 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;
}
 
Example 19
Source File: WalRecoveryTxLogicalRecordsTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<Integer, IndexedValue> ccfg = new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
    ccfg.setIndexedTypes(Integer.class, IndexedValue.class);

    if (extraCcfg != null)
        cfg.setCacheConfiguration(ccfg, new CacheConfiguration<>(extraCcfg));
    else
        cfg.setCacheConfiguration(ccfg);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setPageSize(pageSize);

    dbCfg.setWalHistorySize(WAL_HIST_SIZE);

    dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
        .setMaxSize(100L * 1024 * 1024)
        .setPersistenceEnabled(true));

    if (checkpointFreq != null)
        dbCfg.setCheckpointFrequency(checkpointFreq);

    cfg.setDataStorageConfiguration(dbCfg);

    cfg.setMarshaller(null);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    return cfg;
}
 
Example 20
Source File: IgniteWalRecoveryTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    CacheConfiguration<Integer, IndexedObject> ccfg = renamed ?
        new CacheConfiguration<>(RENAMED_CACHE_NAME) : new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
    ccfg.setNodeFilter(new RemoteNodeFilter());
    ccfg.setIndexedTypes(Integer.class, IndexedObject.class);

    CacheConfiguration<Integer, IndexedObject> locCcfg = new CacheConfiguration<>(LOC_CACHE_NAME);
    locCcfg.setCacheMode(CacheMode.LOCAL);
    locCcfg.setIndexedTypes(Integer.class, IndexedObject.class);

    CacheConfiguration<Object, Object> cfg1 = new CacheConfiguration<>("cache1")
        .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
        .setAffinity(new RendezvousAffinityFunction(false, 32))
        .setCacheMode(CacheMode.PARTITIONED)
        .setRebalanceMode(CacheRebalanceMode.SYNC)
        .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
        .setBackups(0);

    CacheConfiguration<Object, Object> cfg2 = new CacheConfiguration<>(cfg1).setName("cache2").setRebalanceOrder(10);

    cfg.setCacheConfiguration(ccfg, locCcfg, cfg1, cfg2);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setPageSize(4 * 1024);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setInitialSize(256L * 1024 * 1024);
    memPlcCfg.setMaxSize(256L * 1024 * 1024);
    memPlcCfg.setPersistenceEnabled(true);

    dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);

    dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);

    dbCfg.setWalHistorySize(2);

    if (logOnly)
        dbCfg.setWalMode(WALMode.LOG_ONLY);

    if (walSegmentSize != 0)
        dbCfg.setWalSegmentSize(walSegmentSize);

    dbCfg.setWalSegments(walSegments);

    dbCfg.setWalPageCompression(walPageCompression);

    dbCfg.setCheckpointFrequency(checkpointFrequency);

    cfg.setDataStorageConfiguration(dbCfg);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    if (!getTestIgniteInstanceName(0).equals(gridName))
        cfg.setUserAttributes(F.asMap(HAS_CACHE, true));

    if (customFailureDetectionTimeout > 0)
        cfg.setFailureDetectionTimeout(customFailureDetectionTimeout);

    return cfg;
}