/** {@inheritDoc} */ @Override public boolean ownsLockUnsafe(GridCacheEntryEx entry) { return entry.detached() || super.ownsLockUnsafe(entry); }
/** {@inheritDoc} */ @Override public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException { return entry.detached() || super.ownsLock(entry); }
/** {@inheritDoc} */ @Override public void touch(GridCacheEntryEx e) { if (e.detached()) return; try { boolean evicted = e.evictInternal(GridCacheVersionManager.EVICT_VER, null, false) || e.markObsoleteIfEmpty(null); if (evicted && !e.isDht()) // GridDhtCacheEntry removes entry when obsoleted. cctx.cache().removeEntry(e); } catch (IgniteCheckedException ex) { U.error(log, "Failed to evict entry from cache: " + e, ex); } }
/** {@inheritDoc} */ @Override protected void updateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry) throws GridCacheEntryRemovedException { if (entry.detached()) { GridCacheMvccCandidate cand = cctx.mvcc().explicitLock(threadId(), entry.txKey()); if (cand != null && !xidVersion().equals(cand.version())) { GridCacheVersion candVer = cand.version(); txEntry.explicitVersion(candVer); if (candVer.compareTo(minVer) < 0) minVer = candVer; } } else super.updateExplicitVersion(txEntry, entry); }
/** * @param tx Transaction. * @param txEntry Entry to unlock. */ private void txUnlock(IgniteInternalTx tx, IgniteTxEntry txEntry) { while (true) { try { GridCacheEntryEx entry = txEntry.cached(); assert entry != null; if (entry.detached()) break; entry.txUnlock(tx); break; } catch (GridCacheEntryRemovedException ignored) { if (log.isDebugEnabled()) log.debug("Got removed entry in TM txUnlock(..) method (will retry): " + txEntry); txEntry.cached(txEntry.context().cache().entryEx(txEntry.key(), tx.topologyVersion())); } } }
/** {@inheritDoc} */ @Override public void touch(IgniteTxEntry txEntry, boolean loc) { assert txEntry.context() == cctx : "Entry from another cache context passed to eviction manager: [" + "entry=" + txEntry + ", cctx=" + cctx + ", entryCtx=" + txEntry.context() + "]"; if (!plcEnabled) return; if (!loc) { if (cctx.isNear()) return; } GridCacheEntryEx e = txEntry.cached(); if (e.detached() || e.isInternal()) return; try { if (e.markObsoleteIfEmpty(null) || e.obsolete()) e.context().cache().removeEntry(e); } catch (IgniteCheckedException ex) { U.error(log, "Failed to evict entry from cache: " + e, ex); } notifyPolicy(e); }
/** {@inheritDoc} */ @Override protected GridCacheEntryEx entryEx( GridCacheContext cacheCtx, IgniteTxKey key, AffinityTopologyVersion topVer ) { if (cacheCtx.isColocated()) { IgniteTxEntry txEntry = entry(key); if (txEntry == null) return cacheCtx.colocated().entryExx(key.key(), topVer, true); GridCacheEntryEx cached = txEntry.cached(); assert cached != null; if (cached.detached()) return cached; if (cached.obsoleteVersion() != null) { cached = cacheCtx.colocated().entryExx(key.key(), topVer, true); txEntry.cached(cached); } return cached; } else return cacheCtx.cache().entryEx(key.key(), topVer); }
/** {@inheritDoc} */ @Override protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key) { if (cacheCtx.isColocated()) { IgniteTxEntry txEntry = entry(key); if (txEntry == null) return cacheCtx.colocated().entryExx(key.key(), topologyVersion(), true); GridCacheEntryEx cached = txEntry.cached(); assert cached != null; if (cached.detached()) return cached; if (cached.obsoleteVersion() != null) { cached = cacheCtx.colocated().entryExx(key.key(), topologyVersion(), true); txEntry.cached(cached); } return cached; } else return cacheCtx.cache().entryEx(key.key()); }
/** {@inheritDoc} */ @Override public void touch(GridCacheEntryEx e) { assert e.context() == cctx : "Entry from another cache context passed to eviction manager: [" + "entry=" + e + ", cctx=" + cctx + ", entryCtx=" + e.context() + "]"; if (e.detached() || e.isInternal()) return; try { if (e.markObsoleteIfEmpty(null) || e.obsolete()) e.context().cache().removeEntry(e); } catch (IgniteCheckedException ex) { U.error(log, "Failed to evict entry from cache: " + e, ex); } if (!plcEnabled) return; if (!enterBusy()) return; try { if (log.isDebugEnabled()) log.debug("Touching entry [entry=" + e + ", localNode=" + cctx.nodeId() + ']'); notifyPolicy(e); } finally { busyLock.leaveBusy(); } }
e.cached().detached() || !e.context().affinity().primaryByPartition(e.cached().partition(), topologyVersion()).isLocal();
/** * @param tx Transaction. */ private void removeObsolete(IgniteInternalTx tx) { Collection<IgniteTxEntry> entries = tx.local() ? tx.allEntries() : tx.writeEntries(); for (IgniteTxEntry entry : entries) { GridCacheEntryEx cached = entry.cached(); GridCacheContext cacheCtx = entry.context(); if (cached == null) cached = cacheCtx.cache().peekEx(entry.key()); if (cached.detached()) continue; try { if (cached.obsolete() || cached.markObsoleteIfEmpty(tx.xidVersion())) cacheCtx.cache().removeEntry(cached); if (!tx.near() && isNearEnabled(cacheCtx)) { GridNearCacheAdapter near = cacheCtx.isNear() ? cacheCtx.near() : cacheCtx.dht().near(); GridNearCacheEntry e = near.peekExx(entry.key()); if (e != null && e.markObsoleteIfEmpty(null)) near.removeEntry(e); } } catch (IgniteCheckedException e) { U.error(log, "Failed to remove obsolete entry from cache: " + cached, e); } } }
if (cached.detached()) { CacheObject val = cached.rawGet();
tx.topologyVersion()); else if (txEntry.cached().detached()) { GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
if (e.cached().detached() || e.cached().isLocal()) continue;
assert !entry1.detached() : "Expected non-detached entry for near transaction " + "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';
assert txEntry.cached().detached() : txEntry;
assert cached.detached() || cached.lockedByThread(threadId) || isRollbackOnly() : "Transaction lock is not acquired [entry=" + cached + ", tx=" + this + ", nodeId=" + cctx.localNodeId() + ", threadId=" + threadId + ']';
/** {@inheritDoc} */ @Override public boolean ownsLockUnsafe(GridCacheEntryEx entry) { return entry.detached() || super.ownsLockUnsafe(entry); }
/** {@inheritDoc} */ @Override public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException { return entry.detached() || super.ownsLock(entry); }