@Override public String apply(IgniteInternalCache<?, ?> c) { return c.name(); } },
/** {@inheritDoc} */ @Override public String name() { return delegate.name(); }
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { ctx = (GridCacheContext<K, V>)in.readObject(); delegate = (IgniteInternalCache<K, V>)in.readObject(); cacheName = ctx.name(); assert cacheName.equals(delegate.name()) : "ctx.name=" + cacheName + ", delegate.name=" + delegate.name(); }
/** * @param ctx Context. * @param delegate Delegate. * @param async Async support flag. */ private IgniteCacheProxyImpl( @NotNull GridCacheContext<K, V> ctx, @NotNull IgniteInternalCache<K, V> delegate, @NotNull AtomicReference<RestartFuture> restartFut, boolean async ) { super(async); assert ctx != null; assert delegate != null; cacheName = ctx.name(); assert cacheName.equals(delegate.name()) : "ctx.name=" + cacheName + ", delegate.name=" + delegate.name(); this.ctx = ctx; this.delegate = delegate; this.restartFut = restartFut; }
/** * Mark this proxy as restarted. * * @param ctx New cache context. * @param delegate New delegate. */ public void onRestarted(GridCacheContext ctx, IgniteInternalCache delegate) { RestartFuture restartFut = this.restartFut.get(); assert restartFut != null; synchronized (this) { this.restartFut.compareAndSet(restartFut, null); this.ctx = ctx; oldContext = null; this.delegate = delegate; restartFut.onDone(); } assert delegate == null || cacheName.equals(delegate.name()) && cacheName.equals(ctx.name()) : "ctx.name=" + ctx.name() + ", delegate.name=" + delegate.name() + ", cacheName=" + cacheName; }
/** {@inheritDoc} */ @Override protected Void run(VisorCacheRebalanceTaskArg arg) { try { Collection<IgniteInternalFuture<?>> futs = new ArrayList<>(); for (IgniteInternalCache c : ignite.cachesx()) { if (arg.getCacheNames().contains(c.name())) futs.add(c.rebalance()); } for (IgniteInternalFuture f : futs) f.get(); return null; } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public void affinityRun(IgniteRunnable job) { if (!collocated) throw new IgniteException("Failed to execute affinityRun() for non-collocated set: " + name() + ". This operation is supported only for collocated sets."); compute.affinityRun(cache.name(), setKey, job); }
/** {@inheritDoc} */ @Override public <R> R affinityCall(IgniteCallable<R> job) { if (!collocated) throw new IgniteException("Failed to execute affinityCall() for non-collocated set: " + name() + ". This operation is supported only for collocated sets."); return compute.affinityCall(cache.name(), setKey, job); }
/** * Clear statistics globally for the caches * * @param cacheNames Collection of cache names. */ public void clearStatistics(Collection<String> cacheNames) throws IgniteCheckedException { Collection<IgniteInternalCache> caches = manageStatisticsCaches(cacheNames); Collection<String> globalCaches = new HashSet<>(U.capacity(caches.size())); for (IgniteInternalCache cache : caches) { if (!cache.context().isLocal()) globalCaches.add(cache.name()); } if (globalCaches.isEmpty()) return; CacheStatisticsClearMessage msg = new CacheStatisticsClearMessage(UUID.randomUUID(), globalCaches); EnableStatisticsFuture fut = new EnableStatisticsFuture(msg.requestId()); manageStatisticsFuts.put(msg.requestId(), fut); ctx.grid().context().discovery().sendCustomEvent(msg); fut.get(); }
/** * Enable/disable statistics globally for the caches * * @param cacheNames Collection of cache names. * @param enabled Statistics enabled flag. */ public void enableStatistics(Collection<String> cacheNames, boolean enabled) throws IgniteCheckedException { Collection<IgniteInternalCache> caches = manageStatisticsCaches(cacheNames); Collection<String> globalCaches = new HashSet<>(U.capacity(caches.size())); for (IgniteInternalCache cache : caches) { cache.context().statisticsEnabled(enabled); if (!cache.context().isLocal()) globalCaches.add(cache.name()); } if (globalCaches.isEmpty()) return; CacheStatisticsModeChangeMessage msg = new CacheStatisticsModeChangeMessage(UUID.randomUUID(), globalCaches, enabled); EnableStatisticsFuture fut = new EnableStatisticsFuture(msg.requestId()); manageStatisticsFuts.put(msg.requestId(), fut); ctx.grid().context().discovery().sendCustomEvent(msg); fut.get(); }
locCfgsForActivation.put(cache.name(), new T2<>((CacheConfiguration)null, cache.configuration().getNearConfiguration()));
/** * Creates new instance of explicit data streamer. * * @return New instance of data streamer. */ private IgniteDataStreamer<IgfsBlockKey, byte[]> dataStreamer() { IgniteDataStreamer<IgfsBlockKey, byte[]> ldr = igfsCtx.kernalContext().<IgfsBlockKey, byte[]>dataStream().dataStreamer(dataCachePrj.name()); FileSystemConfiguration cfg = igfsCtx.configuration(); if (cfg.getPerNodeBatchSize() > 0) ldr.perNodeBufferSize(cfg.getPerNodeBatchSize()); if (cfg.getPerNodeParallelBatchCount() > 0) ldr.perNodeParallelOperations(cfg.getPerNodeParallelBatchCount()); ldr.receiver(DataStreamerCacheUpdaters.<IgfsBlockKey, byte[]>batchedSorted()); return ldr; }
/** * @throws Exception If failed. */ private void checkAffinity() throws Exception { List<Ignite> nodes = G.allGrids(); ClusterNode crdNode = null; for (Ignite node : nodes) { ClusterNode locNode = node.cluster().localNode(); if (crdNode == null || locNode.order() < crdNode.order()) crdNode = locNode; } AffinityTopologyVersion topVer = ((IgniteKernal)grid(crdNode)). context().cache().context().exchange().readyAffinityVersion(); Map<String, List<List<ClusterNode>>> affMap = new HashMap<>(); for (Ignite node : nodes) { IgniteKernal node0 = (IgniteKernal)node; for (IgniteInternalCache cache : node0.context().cache().caches()) { List<List<ClusterNode>> aff = affMap.get(cache.name()); List<List<ClusterNode>> aff0 = cache.context().affinity().assignments(topVer); if (aff != null) assertEquals(aff, aff0); else affMap.put(cache.name(), aff0); } } }
cache = compatibleCache(cfg, grpName, type, name, separated); DistributedCollectionMetadata newVal = new DistributedCollectionMetadata(type, cfg, cache.name());
/** * Checks that after exchange all nodes have consistent state about partition owners. * * @throws Exception If failed. */ private void checkTopologiesConsistency() throws Exception { List<Ignite> nodes = G.allGrids(); IgniteEx crdNode = null; for (Ignite node : nodes) { ClusterNode locNode = node.cluster().localNode(); if (crdNode == null || locNode.order() < crdNode.localNode().order()) crdNode = (IgniteEx) node; } for (Ignite node : nodes) { IgniteEx node0 = (IgniteEx) node; if (node0.localNode().id().equals(crdNode.localNode().id())) continue; for (IgniteInternalCache cache : node0.context().cache().caches()) { int partitions = cache.context().affinity().partitions(); for (int p = 0; p < partitions; p++) { List<ClusterNode> crdOwners = crdNode.cachex(cache.name()).cache().context().topology().owners(p); List<ClusterNode> owners = cache.context().topology().owners(p); assertEquals(crdOwners, owners); } } } }
public void restart(IgniteInternalCache cache) { for (Map.Entry<GridCacheInternalKey, GridCacheRemovable> e : dsMap.entrySet()) { String cacheName0 = ATOMICS_CACHE_NAME + "@" + e.getKey().groupName(); if (cacheName0.equals(cache.name())) e.getValue().restart(cache); } }
/** {@inheritDoc} */ @Override public <R> R affinityCall(IgniteCallable<R> job) { if (!collocated) throw new IgniteException("Failed to execute affinityCall() for non-collocated set: " + name() + ". This operation is supported only for collocated sets."); return compute.affinityCall(cache.name(), setKey, job); }