/** {@inheritDoc} */ @Override public void invalidPartition(int part) { if (writeMap != null) { for (Iterator<IgniteTxEntry> it = writeMap.values().iterator(); it.hasNext(); ) { IgniteTxEntry e = it.next(); GridCacheContext cacheCtx = e.context(); GridCacheEntryEx cached = e.cached(); if (cached != null) { if (cached.partition() == part) it.remove(); } else if (cacheCtx.affinity().partition(e.key()) == part) it.remove(); } } }
/** * @param e Transaction entry. * @param topVer Topology version. * @return {@code True} if entry is locally mapped as a primary or back up node. */ protected boolean isNearLocallyMapped(GridCacheEntryEx e, AffinityTopologyVersion topVer) { return ctx.affinity().partitionBelongs(ctx.localNode(), e.partition(), topVer); }
/** * @param entry Entry. * @return {@code True} if local node is current primary for given entry. */ private boolean primaryLocal(GridCacheEntryEx entry) { return entry.context().affinity().primaryByPartition(cctx.localNode(), entry.partition(), AffinityTopologyVersion.NONE); }
/** {@inheritDoc} */ @Override public void onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver) { assert entry.isDht(); GridDhtLocalPartition part = topology().localPartition(entry.partition(), AffinityTopologyVersion.NONE, false); if (part != null) part.onDeferredDelete(entry.context().cacheId(), entry.key(), ver); }
/** {@inheritDoc} */ @Override public void batchEvict(Collection<?> keys, @Nullable GridCacheVersion obsoleteVer) throws IgniteCheckedException { boolean recordable = cctx.events().isRecordable(EVT_CACHE_ENTRY_EVICTED); GridCacheAdapter cache = cctx.cache(); // Get all participating entries to avoid deadlock. for (Object k : keys) { KeyCacheObject cacheKey = cctx.toCacheKeyObject(k); GridCacheEntryEx entry = cache.peekEx(cacheKey); if (entry != null && entry.evictInternal(GridCacheVersionManager.EVICT_VER, null, false)) { if (plcEnabled) notifyPolicy(entry); if (recordable) cctx.events().addEvent(entry.partition(), entry.key(), cctx.nodeId(), null, null, null, EVT_CACHE_ENTRY_EVICTED, null, false, entry.rawGet(), entry.hasValue(), null, null, null, false); } } }
if (ctx.events().isRecordable(EVT_CACHE_ENTRY_DESTROYED)) { ctx.events().addEvent(entry.partition(), entry.key(), ctx.localNodeId(),
/** * @param e Transaction entry. * @param primaryOnly Flag to include backups into check or not. * @return {@code True} if entry is locally mapped as a primary or back up node. */ protected boolean isNearLocallyMapped(IgniteTxEntry e, boolean primaryOnly) { GridCacheContext cacheCtx = e.context(); if (!cacheCtx.isNear()) return false; // Try to take either entry-recorded primary node ID, // or transaction node ID from near-local transactions. UUID nodeId = e.nodeId() == null ? local() ? this.nodeId : null : e.nodeId(); if (nodeId != null && nodeId.equals(cctx.localNodeId())) return true; GridCacheEntryEx cached = e.cached(); int part = cached != null ? cached.partition() : cacheCtx.affinity().partition(e.key()); List<ClusterNode> affNodes = cacheCtx.affinity().nodesByPartition(part, topologyVersion()); e.locallyMapped(F.contains(affNodes, cctx.localNode())); if (primaryOnly) { ClusterNode primary = F.first(affNodes); if (primary == null && !cacheCtx.affinityNode()) return false; assert primary != null : "Primary node is null for affinity nodes: " + affNodes; return primary.isLocal(); } else return e.locallyMapped(); }
skip = e.cached().isNear() || e.cached().detached() || !e.context().affinity().primaryByPartition(e.cached().partition(), topologyVersion()).isLocal();
false)) { if (rec && !entry.isInternal()) cctx.events().addEvent(entry.partition(), entry.key(), cctx.localNodeId(), null, null, null, EVT_CACHE_REBALANCE_OBJECT_LOADED, info.value(), true, null, false, null, null, null, false);
Map<ClusterNode, List<KeyCacheObject>> nearMap ) { List<ClusterNode> dhtNodes = ctx.dht().topology().nodes(cached.partition(), topVer);
cctx.events().addEvent(entry.partition(), entry.key(), cctx.nodeId(), null, null, null, EVT_CACHE_ENTRY_EVICTED, null, false, oldVal, hasVal, null, null, null, false);
if (invalidParts != null && F.contains(invalidParts, entry.cached().partition())) { it.remove(); false)) { if (rec && !entry.isInternal()) cacheCtx.events().addEvent(entry.partition(), entry.key(), cctx.localNodeId(), null, null, null, EVT_CACHE_REBALANCE_OBJECT_LOADED, info.value(), true, null, false, null, null, null, false);
if (entry != null && readCommitted()) { if (cacheCtx.isNear()) { if (cacheCtx.affinity().partitionBelongs(cacheCtx.localNode(), entry.partition(), topVer)) { if (entry.markObsolete(xidVer)) cacheCtx.cache().removeEntry(entry);
nodes = cacheCtx.topology().nodes(cached0.partition(), topVer); else nodes = cacheCtx.isLocal() ?
cctx.events().addEvent(cached.partition(), cached.key(), cctx.localNodeId(), null, null, null, EVT_CACHE_REBALANCE_OBJECT_LOADED, entry.value(), true, null, false, null, null, null, true);
/** {@inheritDoc} */ @Override public void invalidPartition(int part) { if (writeMap != null) { for (Iterator<IgniteTxEntry> it = writeMap.values().iterator(); it.hasNext(); ) { IgniteTxEntry e = it.next(); GridCacheContext cacheCtx = e.context(); GridCacheEntryEx cached = e.cached(); if (cached != null) { if (cached.partition() == part) it.remove(); } else if (cacheCtx.affinity().partition(e.key()) == part) it.remove(); } } }
/** * @param e Transaction entry. * @param topVer Topology version. * @return {@code True} if entry is locally mapped as a primary or back up node. */ protected boolean isNearLocallyMapped(GridCacheEntryEx e, AffinityTopologyVersion topVer) { return ctx.affinity().partitionBelongs(ctx.localNode(), e.partition(), topVer); }
/** * @param entry Entry. * @return {@code True} if local node is current primary for given entry. */ private boolean primaryLocal(GridCacheEntryEx entry) { return entry.context().affinity().primaryByPartition(cctx.localNode(), entry.partition(), AffinityTopologyVersion.NONE); }
/** {@inheritDoc} */ @Override public void onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver) { assert entry.isDht(); GridDhtLocalPartition part = topology().localPartition(entry.partition(), AffinityTopologyVersion.NONE, false); if (part != null) part.onDeferredDelete(entry.context().cacheId(), entry.key(), ver); }