Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#getDataRegionName()
The following examples show how to use
org.apache.ignite.configuration.CacheConfiguration#getDataRegionName() .
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: PartitionExtractor.java From ignite with Apache License 2.0 | 6 votes |
/** * Prepare affinity identifier for cache. * * @param ccfg Cache configuration. * @return Affinity identifier. */ private static PartitionTableAffinityDescriptor affinityForCache(CacheConfiguration ccfg) { // Partition could be extracted only from PARTITIONED caches. if (ccfg.getCacheMode() != CacheMode.PARTITIONED) return null; PartitionAffinityFunctionType aff = ccfg.getAffinity().getClass().equals(RendezvousAffinityFunction.class) ? PartitionAffinityFunctionType.RENDEZVOUS : PartitionAffinityFunctionType.CUSTOM; boolean hasNodeFilter = ccfg.getNodeFilter() != null && !(ccfg.getNodeFilter() instanceof CacheConfiguration.IgniteAllNodesPredicate); return new PartitionTableAffinityDescriptor( aff, ccfg.getAffinity().partitions(), hasNodeFilter, ccfg.getDataRegionName() ); }
Example 2
Source File: JdbcThinWalModeChangeSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected void createCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException { String template = ccfg.getCacheMode() == CacheMode.PARTITIONED ? QueryUtils.TEMPLATE_PARTITIONED : QueryUtils.TEMPLATE_REPLICATED; String cmd = "CREATE TABLE IF NOT EXISTS " + ccfg.getName() + " (k BIGINT PRIMARY KEY, v BIGINT) WITH \"" + "TEMPLATE=" + template + ", " + "CACHE_NAME=" + ccfg.getName() + ", " + "ATOMICITY=" + ccfg.getAtomicityMode() + (ccfg.getGroupName() != null ? ", CACHE_GROUP=" + ccfg.getGroupName() : "") + (ccfg.getDataRegionName() != null ? ", DATA_REGION=" + ccfg.getDataRegionName() : "") + "\""; execute(node, cmd); alignCacheTopologyVersion(node); }
Example 3
Source File: GridLocalConfigManager.java From ignite with Apache License 2.0 | 4 votes |
/** * @param cfg Cache configuration. * @param sql SQL flag. * @param caches Caches map. * @param templates Templates map. * @throws IgniteCheckedException If failed. */ private void addCacheFromConfiguration( CacheConfiguration<?, ?> cfg, boolean sql, Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches, Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates ) throws IgniteCheckedException { String cacheName = cfg.getName(); CU.validateCacheName(cacheName); cacheProcessor.cloneCheckSerializable(cfg); CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(cfg); // Initialize defaults. cacheProcessor.initialize(cfg, cacheObjCtx); StoredCacheData cacheData = new StoredCacheData(cfg); cacheData.sql(sql); T2<CacheConfiguration, CacheConfigurationEnrichment> splitCfg = cacheProcessor.splitter().split(cfg); cacheData.config(splitCfg.get1()); cacheData.cacheConfigurationEnrichment(splitCfg.get2()); cfg = splitCfg.get1(); if (GridCacheUtils.isCacheTemplateName(cacheName)) templates.put(cacheName, new CacheJoinNodeDiscoveryData.CacheInfo(cacheData, CacheType.USER, false, 0, true)); else { if (caches.containsKey(cacheName)) { throw new IgniteCheckedException("Duplicate cache name found (check configuration and " + "assign unique name to each cache): " + cacheName); } CacheType cacheType = ctx.cache().cacheType(cacheName); if (cacheType != CacheType.USER && cfg.getDataRegionName() == null) cfg.setDataRegionName(cacheProcessor.context().database().systemDateRegionName()); addStoredCache(caches, cacheData, cacheName, cacheType, false, true); } }
Example 4
Source File: VisorCacheConfiguration.java From ignite with Apache License 2.0 | 4 votes |
/** * Create data transfer object for cache configuration properties. * * @param ignite Grid. * @param ccfg Cache configuration. * @param dynamicDeploymentId Dynamic deployment ID. */ public VisorCacheConfiguration(IgniteEx ignite, CacheConfiguration ccfg, IgniteUuid dynamicDeploymentId) { name = ccfg.getName(); grpName = ccfg.getGroupName(); this.dynamicDeploymentId = dynamicDeploymentId; mode = ccfg.getCacheMode(); atomicityMode = ccfg.getAtomicityMode(); eagerTtl = ccfg.isEagerTtl(); writeSynchronizationMode = ccfg.getWriteSynchronizationMode(); invalidate = ccfg.isInvalidate(); maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations(); interceptor = compactClass(ccfg.getInterceptor()); dfltLockTimeout = ccfg.getDefaultLockTimeout(); qryEntities = VisorQueryEntity.list(ccfg.getQueryEntities()); jdbcTypes = VisorCacheJdbcType.list(ccfg.getCacheStoreFactory()); statisticsEnabled = ccfg.isStatisticsEnabled(); mgmtEnabled = ccfg.isManagementEnabled(); ldrFactory = compactClass(ccfg.getCacheLoaderFactory()); writerFactory = compactClass(ccfg.getCacheWriterFactory()); expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory()); sys = ignite.context().cache().systemCache(ccfg.getName()); storeKeepBinary = ccfg.isStoreKeepBinary(); onheapCache = ccfg.isOnheapCacheEnabled(); partLossPlc = ccfg.getPartitionLossPolicy(); qryParallelism = ccfg.getQueryParallelism(); affinityCfg = new VisorCacheAffinityConfiguration(ccfg); rebalanceCfg = new VisorCacheRebalanceConfiguration(ccfg); evictCfg = new VisorCacheEvictionConfiguration(ccfg); nearCfg = new VisorCacheNearConfiguration(ccfg); storeCfg = new VisorCacheStoreConfiguration(ignite, ccfg); qryCfg = new VisorQueryConfiguration(ccfg); cpOnRead = ccfg.isCopyOnRead(); evictFilter = compactClass(ccfg.getEvictionFilter()); lsnrConfigurations = compactIterable(ccfg.getCacheEntryListenerConfigurations()); loadPrevVal = ccfg.isLoadPreviousValue(); dataRegName = ccfg.getDataRegionName(); sqlIdxMaxInlineSize = ccfg.getSqlIndexMaxInlineSize(); nodeFilter = compactClass(ccfg.getNodeFilter()); qryDetailMetricsSz = ccfg.getQueryDetailMetricsSize(); readFromBackup = ccfg.isReadFromBackup(); tmLookupClsName = ccfg.getTransactionManagerLookupClassName(); topValidator = compactClass(ccfg.getTopologyValidator()); diskPageCompression = ccfg.getDiskPageCompression(); diskPageCompressionLevel = ccfg.getDiskPageCompressionLevel(); }
Example 5
Source File: IgniteKernal.java From ignite with Apache License 2.0 | 4 votes |
/** * Acknowledge all caches configurations presented in the IgniteConfiguration. */ private void ackCacheConfiguration() { CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration(); if (cacheCfgs == null || cacheCfgs.length == 0) U.warn(log, "Cache is not configured - in-memory data grid is off."); else { SB sb = new SB(); HashMap<String, ArrayList<String>> memPlcNamesMapping = new HashMap<>(); for (CacheConfiguration c : cacheCfgs) { String cacheName = U.maskName(c.getName()); String memPlcName = c.getDataRegionName(); if (CU.isSystemCache(cacheName)) memPlcName = "sysMemPlc"; else if (memPlcName == null && cfg.getDataStorageConfiguration() != null) memPlcName = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName(); if (!memPlcNamesMapping.containsKey(memPlcName)) memPlcNamesMapping.put(memPlcName, new ArrayList<String>()); ArrayList<String> cacheNames = memPlcNamesMapping.get(memPlcName); cacheNames.add(cacheName); } for (Map.Entry<String, ArrayList<String>> e : memPlcNamesMapping.entrySet()) { sb.a("in '").a(e.getKey()).a("' dataRegion: ["); for (String s : e.getValue()) sb.a("'").a(s).a("', "); sb.d(sb.length() - 2, sb.length()).a("], "); } U.log(log, "Configured caches [" + sb.d(sb.length() - 2, sb.length()).toString() + ']'); } }
Example 6
Source File: GridCacheUtils.java From ignite with Apache License 2.0 | 2 votes |
/** * Checks whether cache configuration represents IGFS cache that will be placed in system memory region. * * @param ccfg Cache config. */ private static boolean isIgfsCacheInSystemRegion(CacheConfiguration ccfg) { return IgfsUtils.matchIgfsCacheName(ccfg.getName()) && (SYSTEM_DATA_REGION_NAME.equals(ccfg.getDataRegionName()) || ccfg.getDataRegionName() == null); }