Search in sources :

Example 16 with DataStorageConfiguration

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

the class CacheStopAndDestroySelfTest method testLocalCloseWithTry.

/**
 * Test Local close.
 *
 * @throws Exception If failed.
 */
public void testLocalCloseWithTry() throws Exception {
    memCfg = new DataStorageConfiguration();
    startGridsMultiThreaded(gridCount());
    String curVal = null;
    for (int i = 0; i < 3; i++) {
        try (IgniteCache<String, String> cache2 = grid(2).getOrCreateCache(getLocalConfig())) {
            IgniteCache<String, String> cache0 = grid(0).cache(CACHE_NAME_LOC);
            IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_LOC);
            assert cache0.get(KEY_VAL) == null;
            assert cache1.get(KEY_VAL) == null;
            assert cache2.get(KEY_VAL) == null;
            curVal = KEY_VAL + curVal;
            cache0.put(KEY_VAL, curVal + 1);
            cache1.put(KEY_VAL, curVal + 2);
            cache2.put(KEY_VAL, curVal + 3);
            assert cache0.get(KEY_VAL).equals(curVal + 1);
            assert cache1.get(KEY_VAL).equals(curVal + 2);
            assert cache2.get(KEY_VAL).equals(curVal + 3);
        }
    }
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration)

Example 17 with DataStorageConfiguration

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

the class CacheStopAndDestroySelfTest method testLocalClose.

/**
 * Test Local close.
 *
 * @throws Exception If failed.
 */
public void testLocalClose() throws Exception {
    memCfg = new DataStorageConfiguration();
    startGridsMultiThreaded(gridCount());
    grid(0).getOrCreateCache(getLocalConfig());
    assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
    assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
    grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 0);
    grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 1);
    assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 0);
    assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 1);
    // Local close. Same as Local destroy.
    IgniteCache<Object, Object> cache = grid(1).cache(CACHE_NAME_LOC);
    cache.close();
    checkUsageFails(cache);
    assertNull(grid(1).cache(CACHE_NAME_LOC));
    // Local creation after closed.
    AffinityTopologyVersion topVer = grid(1).context().cache().context().exchange().lastTopologyFuture().get();
    IgniteInternalFuture<?> fut = grid(0).context().cache().context().exchange().affinityReadyFuture(topVer);
    if (fut != null)
        fut.get();
    grid(0).getOrCreateCache(getLocalConfig());
    grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated0");
    grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated1");
    grid(2).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated2");
    assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated0");
    assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated1");
    assert grid(2).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated2");
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)

Example 18 with DataStorageConfiguration

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

the class AuthenticationConfigurationClusterTest method configuration.

/**
 * @param idx Node index.
 * @param authEnabled Authentication enabled.
 * @param client Client node flag.
 * @return Ignite configuration.
 * @throws Exception On error.
 */
private IgniteConfiguration configuration(int idx, boolean authEnabled, boolean client) throws Exception {
    IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(idx));
    cfg.setClientMode(client);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(spi);
    cfg.setAuthenticationEnabled(authEnabled);
    cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
    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 19 with DataStorageConfiguration

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

the class AuthenticationProcessorNodeRestartTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    if (getTestIgniteInstanceIndex(igniteInstanceName) == CLI_NODE)
        cfg.setClientMode(true);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(spi);
    cfg.setAuthenticationEnabled(true);
    cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
    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 20 with DataStorageConfiguration

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

the class IgnitePdsCheckpointSimpleTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    DataRegionConfiguration regCfg = new DataRegionConfiguration().setPersistenceEnabled(true);
    DataStorageConfiguration dsCfg = new DataStorageConfiguration().setPageSize(4 * 1024).setDefaultDataRegionConfiguration(regCfg).setCheckpointFrequency(TimeUnit.SECONDS.toMillis(10));
    return cfg.setDataStorageConfiguration(dsCfg);
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration)

Aggregations

DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)143 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)120 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)119 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)55 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)51 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)33 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)17 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 File (java.io.File)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 ArrayList (java.util.ArrayList)4 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)4 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)3 IgniteOutOfMemoryException (org.apache.ignite.internal.mem.IgniteOutOfMemoryException)3 IOException (java.io.IOException)2 LinkedHashMap (java.util.LinkedHashMap)2 QueryEntity (org.apache.ignite.cache.QueryEntity)2 QueryIndex (org.apache.ignite.cache.QueryIndex)2