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

The following examples show how to use org.apache.ignite.configuration.DataStorageConfiguration#setWalArchivePath() . 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: IgniteUidAsConsistentIdMigrationTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(gridName);

    if (configuredConsistentId != null)
        cfg.setConsistentId(configuredConsistentId);

    final DataStorageConfiguration dsCfg = new DataStorageConfiguration();

    if (placeStorageInTemp) {
        final File tempDir = new File(System.getProperty("java.io.tmpdir"));

        pstStoreCustomPath = new File(tempDir, "Store");
        pstWalStoreCustomPath = new File(tempDir, "WalStore");
        pstWalArchCustomPath = new File(tempDir, "WalArchive");

        dsCfg.setStoragePath(pstStoreCustomPath.getAbsolutePath());
        dsCfg.setWalPath(pstWalStoreCustomPath.getAbsolutePath());
        dsCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath());
    }

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

    cfg.setDataStorageConfiguration(dsCfg);

    if (strLog != null)
        cfg.setGridLogger(strLog);

    return cfg;
}
 
Example 2
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 3
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 4
Source File: IgniteMassLoadSandboxTest.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);

    CacheConfiguration<Integer, HugeIndexedObject> ccfg = new CacheConfiguration<>();

    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 1024));
    ccfg.setIndexedTypes(Integer.class, HugeIndexedObject.class);
    ccfg.setName(CACHE_NAME);

    cfg.setCacheConfiguration(ccfg);

    DataRegionConfiguration regCfg = new DataRegionConfiguration()
        .setName("dfltMemPlc")
        .setMetricsEnabled(true)
        .setMaxSize(2 * 1024L * 1024 * 1024)
        .setPersistenceEnabled(true);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration();

    dsCfg.setDefaultDataRegionConfiguration(regCfg)
        .setPageSize(4 * 1024)
        .setWriteThrottlingEnabled(true)
        .setCheckpointFrequency(checkpointFrequency);

    final String workDir = U.defaultWorkDirectory();
    final File db = U.resolveWorkDirectory(workDir, DFLT_STORE_DIR, false);
    final File wal = new File(db, "wal");
    if (setWalArchAndWorkToSameVal) {
        final String walAbsPath = wal.getAbsolutePath();

        dsCfg.setWalPath(walAbsPath);

        dsCfg.setWalArchivePath(walAbsPath);
    }
    else {
        dsCfg.setWalPath(wal.getAbsolutePath());

        dsCfg.setWalArchivePath(new File(wal, "archive").getAbsolutePath());
    }

    dsCfg.setWalMode(customWalMode != null ? customWalMode : WALMode.LOG_ONLY)
        .setWalHistorySize(1)
        .setWalSegments(10);

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

    cfg.setDataStorageConfiguration(dsCfg);

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

    return cfg;
}
 
Example 5
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 6
Source File: IgniteWalReaderTest.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);

    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(EVT_WAL_SEGMENT_ARCHIVED, EVT_WAL_SEGMENT_COMPACTED);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration()
                .setMaxSize(1024L * 1024 * 1024)
                .setPersistenceEnabled(true))
        .setWalSegmentSize(1024 * 1024)
        .setWalSegments(WAL_SEGMENTS)
        .setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND)
        .setWalCompactionEnabled(enableWalCompaction);

    if (archiveIncompleteSegmentAfterInactivityMs > 0)
        dsCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs);

    String workDir = U.defaultWorkDirectory();
    File db = U.resolveWorkDirectory(workDir, DFLT_STORE_DIR, false);
    File wal = new File(db, "wal");

    if (setWalAndArchiveToSameVal) {
        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;
}