Search in sources :

Example 1 with CacheConfiguration

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

the class GridPartitionedCacheJtaLookupClassNameSelfTest method testUncompatibleTmLookup.

/**
     *
     */
@IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-1094", forceFailure = true)
public void testUncompatibleTmLookup() {
    final IgniteEx ignite = grid(0);
    final CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cacheCfg.setName("Foo");
    cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cacheCfg.setTransactionManagerLookupClassName(TestTmLookup2.class.getName());
    GridTestUtils.assertThrows(log, new Callable<Object>() {

        @Override
        public Object call() throws IgniteException {
            ignite.createCache(cacheCfg);
            return null;
        }
    }, IgniteException.class, null);
}
Also used : IgniteException(org.apache.ignite.IgniteException) IgniteEx(org.apache.ignite.internal.IgniteEx) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) IgniteIgnore(org.apache.ignite.testsuites.IgniteIgnore)

Example 2 with CacheConfiguration

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

the class LocalAffinityFunctionTest method getConfiguration.

@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setBackups(1);
    ccfg.setName(CACHE1);
    ccfg.setCacheMode(CacheMode.LOCAL);
    ccfg.setAffinity(new RendezvousAffinityFunction());
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 3 with CacheConfiguration

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

the class LocalAffinityFunctionTest method testWronglySetAffinityFunctionForLocalCache.

public void testWronglySetAffinityFunctionForLocalCache() {
    Ignite node = ignite(NODE_CNT - 1);
    CacheConfiguration ccf = node.cache(CACHE1).getConfiguration(CacheConfiguration.class);
    assertEquals("org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunction", ccf.getAffinity().getClass().getName());
}
Also used : Ignite(org.apache.ignite.Ignite) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 4 with CacheConfiguration

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

the class DataStructuresProcessor method compatibleConfiguration.

/**
     * @param cfg Collection configuration.
     * @return Cache name.
     * @throws IgniteCheckedException If failed.
     */
private String compatibleConfiguration(CollectionConfiguration cfg) throws IgniteCheckedException {
    List<CacheCollectionInfo> caches = utilityDataCache.context().affinityNode() ? utilityDataCache.localPeek(DATA_STRUCTURES_CACHE_KEY, null, null) : utilityDataCache.get(DATA_STRUCTURES_CACHE_KEY);
    String cacheName = findCompatibleConfiguration(cfg, caches);
    if (cacheName == null)
        cacheName = utilityDataCache.invoke(DATA_STRUCTURES_CACHE_KEY, new AddDataCacheProcessor(cfg)).get();
    assert cacheName != null;
    CacheConfiguration newCfg = cacheConfiguration(cfg, cacheName);
    if (ctx.cache().cache(cacheName) == null) {
        ctx.cache().dynamicStartCache(newCfg, cacheName, null, CacheType.INTERNAL, false, false, true, true).get();
    }
    assert ctx.cache().cache(cacheName) != null : cacheName;
    return cacheName;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 5 with CacheConfiguration

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

the class PlatformProcessorImpl method getOrCreateCacheFromConfig.

/** {@inheritDoc} */
@Override
public PlatformTargetProxy getOrCreateCacheFromConfig(long memPtr) throws IgniteCheckedException {
    BinaryRawReaderEx reader = platformCtx.reader(platformCtx.memory().get(memPtr));
    CacheConfiguration cfg = PlatformConfigurationUtils.readCacheConfiguration(reader);
    IgniteCacheProxy cache = reader.readBoolean() ? (IgniteCacheProxy) ctx.grid().getOrCreateCache(cfg, PlatformConfigurationUtils.readNearConfiguration(reader)) : (IgniteCacheProxy) ctx.grid().getOrCreateCache(cfg);
    return createPlatformCache(cache);
}
Also used : IgniteCacheProxy(org.apache.ignite.internal.processors.cache.IgniteCacheProxy) BinaryRawReaderEx(org.apache.ignite.internal.binary.BinaryRawReaderEx) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1234 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)474 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)330 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)292 Ignite (org.apache.ignite.Ignite)202 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)127 ArrayList (java.util.ArrayList)95 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)82 IgniteEx (org.apache.ignite.internal.IgniteEx)60 QueryEntity (org.apache.ignite.cache.QueryEntity)59 IgniteCache (org.apache.ignite.IgniteCache)55 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)54 CacheException (javax.cache.CacheException)51 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)51 IgniteException (org.apache.ignite.IgniteException)50 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)45 LinkedHashMap (java.util.LinkedHashMap)41 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)41 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)38 Transaction (org.apache.ignite.transactions.Transaction)35