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

The following examples show how to use org.apache.ignite.configuration.DataStorageConfiguration#setWalHistorySize() . 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
/**
 * History size parameters consistency check. Should be set just one of wal history size or max wal archive size.
 */
@Test
public void testGridDoesNotStart_BecauseBothWalHistorySizeAndMaxWalArchiveSizeUsed() throws Exception {
    //given: wal history size and max wal archive size are both set.
    IgniteConfiguration configuration = getConfiguration(getTestIgniteInstanceName());

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();
    dbCfg.setWalHistorySize(12);
    dbCfg.setMaxWalArchiveSize(9);
    configuration.setDataStorageConfiguration(dbCfg);

    try {
        //when: start grid.
        startGrid(getTestIgniteInstanceName(), configuration);
        fail("Should be fail because both wal history size and max wal archive size was used");
    }
    catch (IgniteException e) {
        //then: exception is occurrence because should be set just one parameters.
        assertTrue(findSourceMessage(e).startsWith("Should be used only one of wal history size or max wal archive size"));
    }
}
 
Example 2
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 3
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 4
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 5
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 6
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;
}