/** * @param ctx Shared cache context. */ public static <K, V> void unwindEvicts(GridCacheSharedContext<K, V> ctx) { assert ctx != null; for (GridCacheContext<K, V> cacheCtx : ctx.cacheContexts()) unwindEvicts(cacheCtx); }
/** * @return Data center ID. */ public byte dataCenterId() { // Data center ID is same for all caches, so grab the first one. GridCacheContext<?, ?> cacheCtx = F.first(cacheContexts()); return cacheCtx.dataCenterId(); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException { for (Map.Entry<GridCacheInternalKey, GridCacheRemovable> e : dsMap.entrySet()) { GridCacheRemovable obj = e.getValue(); if (clusterRestarted) { obj.onRemoved(); dsMap.remove(e.getKey(), obj); } else obj.needCheckNotRemoved(); } for (GridCacheContext cctx : ctx.cache().context().cacheContexts()) cctx.dataStructures().onReconnected(clusterRestarted); return null; }
/** * @param threadId Thread id. * @return True if thread have system transaction. False otherwise. */ private boolean haveSystemTxForThread(long threadId) { if (!sysThreadMap.isEmpty()) { for (GridCacheContext cacheCtx : cctx.cache().context().cacheContexts()) { if (!cacheCtx.systemTx()) continue; if (sysThreadMap.containsKey(new TxThreadKey(threadId, cacheCtx.cacheId()))) return true; } } return false; }
@Override public void run() { for (GridCacheContext ctxs : ctx.cache().context().cacheContexts()) ctxs.queries().evictDetailMetrics(); } }, QRY_DETAIL_METRICS_EVICTION_FREQ, QRY_DETAIL_METRICS_EVICTION_FREQ);
/** * @param threadId Thread ID. * @param ignore Transaction to ignore. * @return Not null topology version if current thread holds lock preventing topology change. */ @Nullable public AffinityTopologyVersion lockedTopologyVersion(long threadId, IgniteInternalTx ignore) { IgniteInternalTx tx = threadMap.get(threadId); if (tx != null) { AffinityTopologyVersion topVer = tx.topologyVersionSnapshot(); if (topVer != null) return topVer; } if (!sysThreadMap.isEmpty()) { for (GridCacheContext cacheCtx : cctx.cache().context().cacheContexts()) { if (!cacheCtx.systemTx()) continue; tx = sysThreadMap.get(new TxThreadKey(threadId, cacheCtx.cacheId())); if (tx != null && tx != ignore) { AffinityTopologyVersion topVer = tx.topologyVersionSnapshot(); if (topVer != null) return topVer; } } } return txTop.get(); }
/** * @param ignite Node. * @param expHist Expected history. * @param expSize Expected 'non client events' history size. * @throws Exception If failed. */ private void checkHistory(Ignite ignite, List<AffinityTopologyVersion> expHist, int expSize) throws Exception { awaitPartitionMapExchange(); GridCacheProcessor proc = ((IgniteKernal)ignite).context().cache(); int cnt = 0; for (GridCacheContext cctx : proc.context().cacheContexts()) { GridAffinityAssignmentCache aff = GridTestUtils.getFieldValue(cctx.affinity(), "aff"); AtomicInteger fullHistSize = GridTestUtils.getFieldValue(aff, "fullHistSize"); assertEquals(expSize, fullHistSize.get()); Map<AffinityTopologyVersion, Object> cache = GridTestUtils.getFieldValue(aff, "affCache"); assertEquals("Unexpected history: " + cache.keySet(), expHist.size(), cache.size()); for (AffinityTopologyVersion topVer : expHist) assertTrue("No history [ver=" + topVer + ", hist=" + cache.keySet() + ']', cache.containsKey(topVer)); cnt++; } assert cnt > 4; }
for (final GridCacheContext cacheCtx : (Collection<GridCacheContext>)cctx.cacheContexts()) { if (cacheCtx.startTopologyVersion().equals(fut.initialVersion())) { final int cacheId = cacheCtx.cacheId();
for (GridCacheContext cctx : ctx.cache().context().cacheContexts()) { cctx.gate().writeLock();
fut.get(); for (GridCacheContext cctx : node0.context().cache().context().cacheContexts()) { if (cctx.startTopologyVersion().compareTo(topVer) > 0) continue;
!cctx.kernalContext().clientNode() && (serverNodeDiscoveryEvent() || affChangeMsg != null)) { for (GridCacheContext cacheCtx : cctx.cacheContexts()) { if (!cacheCtx.affinityNode() || cacheCtx.isLocal()) continue; for (GridCacheContext cacheCtx : cctx.cacheContexts()) { GridCacheContext drCacheCtx = cacheCtx.isNear() ? cacheCtx.near().dht().context() : cacheCtx;
for (GridCacheContext ctx : ignite.context().cache().context().cacheContexts()) { if (ctx.name() != null && ctx.name().startsWith("datastructures")) { ctx.cache().rebalance().get();
for (GridCacheContext cacheCtx : cctx.cacheContexts()) { if (cacheCtx.isLocal() || cacheStopping(cacheCtx.cacheId())) continue;
/** * @param ctx Shared cache context. */ public static <K, V> void unwindEvicts(GridCacheSharedContext<K, V> ctx) { assert ctx != null; for (GridCacheContext<K, V> cacheCtx : ctx.cacheContexts()) unwindEvicts(cacheCtx); }
/** * @return Data center ID. */ public byte dataCenterId() { // Data center ID is same for all caches, so grab the first one. GridCacheContext<?, ?> cacheCtx = F.first(cacheContexts()); return cacheCtx.dataCenterId(); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException { for (Map.Entry<GridCacheInternalKey, GridCacheRemovable> e : dsMap.entrySet()) { GridCacheRemovable obj = e.getValue(); if (clusterRestarted) { obj.onRemoved(); dsMap.remove(e.getKey(), obj); } else obj.needCheckNotRemoved(); } for (GridCacheContext cctx : ctx.cache().context().cacheContexts()) cctx.dataStructures().onReconnected(clusterRestarted); return null; }
/** * @param threadId Thread id. * @return True if thread have system transaction. False otherwise. */ private boolean haveSystemTxForThread(long threadId) { if (!sysThreadMap.isEmpty()) { for (GridCacheContext cacheCtx : cctx.cache().context().cacheContexts()) { if (!cacheCtx.systemTx()) continue; if (sysThreadMap.containsKey(new TxThreadKey(threadId, cacheCtx.cacheId()))) return true; } } return false; }
@Override public void run() { for (GridCacheContext ctxs : ctx.cache().context().cacheContexts()) ctxs.queries().evictDetailMetrics(); } }, QRY_DETAIL_METRICS_EVICTION_FREQ, QRY_DETAIL_METRICS_EVICTION_FREQ);
/** * @param threadId Thread ID. * @param ignore Transaction to ignore. * @return Not null topology version if current thread holds lock preventing topology change. */ @Nullable public AffinityTopologyVersion lockedTopologyVersion(long threadId, IgniteInternalTx ignore) { IgniteInternalTx tx = threadMap.get(threadId); if (tx != null) { AffinityTopologyVersion topVer = tx.topologyVersionSnapshot(); if (topVer != null) return topVer; } if (!sysThreadMap.isEmpty()) { for (GridCacheContext cacheCtx : cctx.cache().context().cacheContexts()) { if (!cacheCtx.systemTx()) continue; tx = sysThreadMap.get(new TxThreadKey(threadId, cacheCtx.cacheId())); if (tx != null && tx != ignore) { AffinityTopologyVersion topVer = tx.topologyVersionSnapshot(); if (topVer != null) return topVer; } } } return txTop.get(); }
for (final GridCacheContext cacheCtx : (Collection<GridCacheContext>)cctx.cacheContexts()) { if (cacheCtx.startTopologyVersion().equals(fut.initialVersion())) { final int cacheId = cacheCtx.cacheId();