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

The following examples show how to use org.apache.ignite.configuration.DataStorageConfiguration#setCheckpointFrequency() . 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: WalDeletionArchiveAbstractTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Start grid with override default configuration via customConfigurator.
 */
private Ignite startGrid(Consumer<DataStorageConfiguration> customConfigurator) throws Exception {
    IgniteConfiguration configuration = getConfiguration(getTestIgniteInstanceName());

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setWalMode(walMode());
    dbCfg.setWalSegmentSize(512 * 1024);
    dbCfg.setCheckpointFrequency(60 * 1000);//too high value for turn off frequency checkpoint.
    dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
        .setMaxSize(100 * 1024 * 1024)
        .setPersistenceEnabled(true));

    customConfigurator.accept(dbCfg);

    configuration.setDataStorageConfiguration(dbCfg);

    Ignite ignite = startGrid(configuration);

    ignite.active(true);

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

    DataStorageConfiguration dataStorageConfiguration = new DataStorageConfiguration();

    dataStorageConfiguration
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration()
                .setName(PERSISTENT_REGION_NAME)
                .setInitialSize(100L * 1024 * 1024)
                .setMaxSize(1024L * 1024 * 1024)
                .setPersistenceEnabled(true))
        .setDataRegionConfigurations(
            new DataRegionConfiguration()
                .setName(MEMORY_REGION_NAME)
                .setInitialSize(100L * 1024 * 1024)
                .setMaxSize(1024L * 1024 * 1024)
                .setPersistenceEnabled(false));

    dataStorageConfiguration.setCheckpointFrequency(5000);

    return cfg.setCacheConfiguration(
            getCacheConfig(PERSISTENT_CACHE_NAME, PERSISTENT_REGION_NAME),
            getCacheConfig(MEMORY_CACHE_NAME, MEMORY_REGION_NAME))
        .setDataStorageConfiguration(dataStorageConfiguration);
}
 
Example 3
Source File: CacheDataRegionConfigurationTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Negative test: verifies that no warning is printed to logs if user starts static and dynamic caches
 * in data region with enough capacity to host these caches;
 * in other words, no thresholds for metapages ration are broken.
 *
 * @throws Exception If failed.
 */
@Test
public void testNoWarningIfCacheConfigurationDoesntBreakThreshold() 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);

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

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

    ccfg = fewPartitionsCache;

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

    IgniteEx ignite0 = startGrid("srv0");

    ignite0.cluster().active(true);

    assertFalse(cacheGrpLsnr0.check());

    ignite0.createCache(new CacheConfiguration<>("dynamicCache")
        .setAffinity(new RendezvousAffinityFunction(false, 16))
    );

    assertFalse(dynamicGrpLsnr.check());
}
 
Example 4
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 5
Source File: IgnitePdsCacheDestroyDuringCheckpointTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @return DB config.
 */
private DataStorageConfiguration createDbConfig() {
    DataStorageConfiguration storageCfg = new DataStorageConfiguration();
    storageCfg.setCheckpointFrequency(300);

    storageCfg.setDefaultDataRegionConfiguration(
        new DataRegionConfiguration()
            .setPersistenceEnabled(true)
            .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)
    );

    return storageCfg;
}
 
Example 6
Source File: DefaultPageSizeBackwardsCompatibilityTest.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 memCfg = new DataStorageConfiguration();

    if (set16kPageSize)
        memCfg.setPageSize(16 * 1024);
    else
        memCfg.setPageSize(0); // Enforce default.

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
    memPlcCfg.setMaxSize(100L * 1000 * 1000);
    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setPersistenceEnabled(true);

    memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
    memCfg.setCheckpointFrequency(500);

    cfg.setDataStorageConfiguration(memCfg);

    CacheConfiguration ccfg1 = new CacheConfiguration();

    ccfg1.setName(CACHE_NAME);
    ccfg1.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg1.setAffinity(new RendezvousAffinityFunction(false, 32));

    if (!set16kPageSize)
        ccfg1.setDiskPageCompression(null);

    cfg.setCacheConfiguration(ccfg1);

    cfg.setConsistentId(gridName);

    return cfg;
}
 
Example 7
Source File: IgnitePersistentStoreSchemaLoadTest.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.setCacheConfiguration(cacheCfg(TMPL_NAME));

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

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

    pCfg.setCheckpointFrequency(1000);

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 8
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 9
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 dynamic cache in data region which
 * overhead (e.g. metapages for partitions) occupies more space of the region than a defined threshold.
 *
 * @throws Exception If failed.
 */
@Test
public void testWarningIfDynamicCacheOverheadExceedsThreshold() throws Exception {
    String filteredSrvName = "srv2";
    int numOfPartitions = 512;
    int partitionsMetaMemoryChunk = U.sizeInMegabytes(512 * DFLT_PAGE_SIZE);

    DataRegionConfiguration smallRegionCfg = new DataRegionConfiguration();

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

    //explicit default data region configuration to test possible NPE case
    DataRegionConfiguration defaultRegionCfg = new DataRegionConfiguration();
    defaultRegionCfg.setName("defaultRegion");
    defaultRegionCfg.setInitialSize(DFLT_MEM_PLC_SIZE);
    defaultRegionCfg.setMaxSize(DFLT_MEM_PLC_SIZE);
    defaultRegionCfg.setPersistenceEnabled(true);

    memCfg = new DataStorageConfiguration();
    memCfg.setDefaultDataRegionConfiguration(defaultRegionCfg);
    memCfg.setDataRegionConfigurations(smallRegionCfg);
    //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();
    LogListener dataRegLsnr0 = matches("metainformation in data region 'defaultRegion'").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 'defaultRegion'").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");

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

    startGrid("srv2");

    ignite0.cluster().active(true);

    IgniteEx cl = startGrid("client01");

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

    manyPartitionsCache.setAffinity(new RendezvousAffinityFunction(false, numOfPartitions));
    manyPartitionsCache.setNodeFilter(new NodeNameNodeFilter(filteredSrvName));
    manyPartitionsCache.setBackups(1);

    cl.createCache(manyPartitionsCache);

    //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());

    //srv2 doesn't print the warning as it is filtered by node filter from affinity nodes
    assertFalse(cacheGrpLsnr2.check());
}
 
Example 10
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 11
Source File: IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.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);

    cfg.setCacheConfiguration(cacheCfg(CACHE_NAME));

    DataStorageConfiguration pCfg = new DataStorageConfiguration();

    pCfg.setCheckpointFrequency(1000);

    cfg.setDataStorageConfiguration(pCfg);

    return cfg;
}
 
Example 12
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 13
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;
}
 
Example 14
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;
}