/** * @param key Key. * @param cacheName Cache name. * @return {@code True} if matches. */ private static boolean missedCacheTypeKeyMatches(long key, String cacheName) { int cacheId = CU.cacheId(cacheName); long cacheIdShifted = ((long)cacheId << 32); return (key & cacheIdShifted) == cacheIdShifted; }
Collection<ClusterNode> nodes = CU.affinityNodes(cctx, AffinityTopologyVersion.NONE);
Map<UUID, Collection<UUID>> txNodes) super(CU.boolReducer());
int cacheId = CU.cacheId(cfg.getName()); int grpId = CU.cacheGroupId(cfg.getName(), cfg.getGroupName());
/** */ private boolean isInMemoryMode() { return !CU.isPersistenceEnabled(cfg); }
@Override public CountDownLatch call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheCountDownLatchValue val = cacheView.get(key); if (val == null) { if (log.isDebugEnabled()) log.debug("Failed to find count down latch with given name: " + name); return new CountDownLatch(0); } tx.commit(); return new CountDownLatch(val.get()); } } });
/** * @return {@code True} if starting system caches. */ public boolean systemCachesStarting() { if (cachesToStart != null) { for (CacheActionData data : cachesToStart.values()) { if (CU.isSystemCache(data.request().cacheName())) return true; } } return false; }
int grpId = CU.cacheGroupId(startedCacheCfg.getName(), startedCacheCfg.getGroupName());
!CU.isSystemCache(cc.getName()) && !(c.getMarshaller() instanceof BinaryMarshaller)) throw new IgniteCheckedException("Cache can be started in PRIVATE or ISOLATED deployment mode only when" + " BinaryMarshaller is used [depMode=" + ctx.config().getDeploymentMode() + ", marshaller=" + if (!CU.isPersistentCache(cc, c.getDataStorageConfiguration())) { throw new IgniteCheckedException("Using encryption is not allowed" + " for not persistent cache [cacheName=" + cc.getName() + ", groupName=" + cc.getGroupName() +
DynamicCacheDescriptor desc = startReq.descriptor(); if (CU.isPersistentCache(desc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration())) startDescs.add(desc); if (CU.isPersistenceEnabled(cctx.kernalContext().config()) && !cctx.kernalContext().clientNode()) cctx.kernalContext().state().onBaselineTopologyChanged(req.baselineTopology(), req.prevBaselineTopologyHistoryItem());
/** * Checks whether given cache configuration should be persisted. * * @param cacheCfg Cache config. * @return {@code True} if cache configuration should be persisted, {@code false} in other case. */ private boolean shouldPersist(CacheConfiguration<?, ?> cacheCfg) { return cctx.pageStore() != null && CU.isPersistentCache(cacheCfg, cctx.gridConfig().getDataStorageConfiguration()) && !cctx.kernalContext().clientNode(); }
/** {@inheritDoc} */ @Override public Void call() throws Exception { CU.checkAttributeMismatch(strLog, "cache", node.id(), "cacheMode", "Cache mode", LOCAL, PARTITIONED, true); return null; } }, IgniteCheckedException.class, "Cache mode mismatch");
/** * @param cctx Cache context. */ private void cleanup(GridCacheContext cctx) { CacheConfiguration cfg = cctx.config(); cleanup(cfg, cfg.getAffinity(), false); cleanup(cfg, cfg.getAffinityMapper(), false); cleanup(cfg, cfg.getEvictionFilter(), false); cleanup(cfg, cfg.getInterceptor(), false); cleanup(cfg, cctx.store().configuredStore(), false); if (!CU.isUtilityCache(cfg.getName()) && !CU.isSystemCache(cfg.getName())) { unregisterMbean(cctx.cache().localMxBean(), cfg.getName(), false); unregisterMbean(cctx.cache().clusterMxBean(), cfg.getName(), false); } cctx.cleanup(); }
if (!ctx.clientNode()) { return CU.isPersistentCache(startedCacheCfg, ctx.config().getDataStorageConfiguration()); if (CU.affinityNode(srvNode, startedCacheCfg.getNodeFilter())) { Object dsCfgBytes = srvNode.attribute(IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG); (byte[])dsCfgBytes, U.resolveClassLoader(ctx.config())); return CU.isPersistentCache(startedCacheCfg, crdDsCfg);
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheMode", "Cache mode", locAttr.cacheMode(), rmtAttr.cacheMode(), true); CU.checkAttributeMismatch(log, rmtAttr.groupName(), rmt, "groupName", "Cache group name", locAttr.groupName(), rmtAttr.groupName(), true); CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "interceptor", "Cache Interceptor", locAttr.interceptorClassName(), rmtAttr.interceptorClassName(), true); CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "atomicityMode", "Cache atomicity mode", locAttr.atomicityMode(), rmtAttr.atomicityMode(), true); CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cachePreloadMode", "Cache preload mode", locAttr.cacheRebalanceMode(), rmtAttr.cacheRebalanceMode(), true); CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "topologyValidator", "Cache topology validator", locAttr.topologyValidatorClassName(), rmtAttr.topologyValidatorClassName(), true); if (CU.affinityNode(ctx.discovery().localNode(), locInfo.cacheData().config().getNodeFilter()) && rmtNode != null && CU.affinityNode(rmtNode, rmtData.cacheConfiguration().getNodeFilter())) { CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "storeFactory", "Store factory", locAttr.storeFactoryClassName(), rmtAttr.storeFactoryClassName(), true); CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheAffinity", "Cache affinity", locAttr.cacheAffinityClassName(), rmtAttr.cacheAffinityClassName(), true); CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheAffinityMapper", "Cache affinity mapper", locAttr.cacheAffinityMapperClassName(), rmtAttr.cacheAffinityMapperClassName(), true);
int cacheId = CU.cacheId(cfg.getName()); int grpId = CU.cacheGroupId(cfg.getName(), cfg.getGroupName());
/** * Restores metadata on startup of {@link CacheObjectBinaryProcessorImpl} but before starting discovery. */ void restoreMetadata() { if (!CU.isPersistenceEnabled(ctx.config())) return; for (File file : workDir.listFiles()) { try (FileInputStream in = new FileInputStream(file)) { BinaryMetadata meta = U.unmarshal(ctx.config().getMarshaller(), in, U.resolveClassLoader(ctx.config())); metadataLocCache.put(meta.typeId(), new BinaryMetadataHolder(meta, 0, 0)); } catch (Exception e) { U.warn(log, "Failed to restore metadata from file: " + file.getName() + "; exception was thrown: " + e.getMessage()); } } }
@Override public Integer call() throws Exception { try ( GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ) ) { GridCacheSemaphoreState val = cacheView.get(key); if (val == null) throw new IgniteException("Failed to find semaphore with given name: " + name); int cnt = val.getCount(); tx.rollback(); return cnt; } } });
/** * @return {@code True} if this is cache group for one of system caches. */ public boolean systemCache() { return !sharedGroup() && CU.isSystemCache(ccfg.getName()); }
/** @throws Exception If failed. */ @Test public void testCreateEncryptedCache() throws Exception { CacheConfiguration<Long, String> ccfg = new CacheConfiguration<>(ENCRYPTED_CACHE); ccfg.setEncryptionEnabled(true); IgniteEx grid = grid(0); grid.createCache(ccfg); IgniteInternalCache<Object, Object> enc = grid.cachex(ENCRYPTED_CACHE); assertNotNull(enc); KeystoreEncryptionKey key = (KeystoreEncryptionKey)grid.context().encryption().groupKey(CU.cacheGroupId(ENCRYPTED_CACHE, null)); assertNotNull(key); assertNotNull(key.key()); }