if (entry.obsolete()) {
/** * Go through all candidates for entries involved in transaction and find their min * version. We know that these candidates will commit after this transaction, and * therefore we can grab the min version so we can send all committed and rolled * back versions from min to current to remote nodes for re-ordering. * * @param entries Entries. * @param min Min version so far. * @param tx Transaction. * @return Minimal available version. */ private GridCacheVersion minVersion(Iterable<IgniteTxEntry> entries, GridCacheVersion min, IgniteInternalTx tx) { for (IgniteTxEntry txEntry : entries) { GridCacheEntryEx cached = txEntry.cached(); // We are assuming that this method is only called on commit. In that // case, if lock is held, entry can never be removed. assert txEntry.isRead() || !cached.obsolete(tx.xidVersion()) : "Invalid obsolete version for transaction [entry=" + cached + ", tx=" + tx + ']'; for (GridCacheMvccCandidate cand : cached.remoteMvccSnapshot()) if (min == null || cand.version().isLess(min)) min = cand.version(); } return min; }
if (entry.obsolete() || (storeErr != null && storeErr.failedKeys().contains(entry.key().value(ctx.cacheObjectContext(), false)))) continue;
if (!cached.obsolete()) { for (GridCacheMvccCandidate cand : cached.localCandidates()) { if (!cand.owner() && cand.version().compareTo(baseVer) < 0) {
/** {@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); }
entry.lockEntry(); if (!entry.obsolete()) break;
/** {@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(); } }
/** * @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); } } }
continue; if (e.cached().obsolete()) { GridCacheEntryEx cached = cacheCtx.cache().entryEx(e.key(), topologyVersion());
if (entry.obsolete()) {
/** * Go through all candidates for entries involved in transaction and find their min * version. We know that these candidates will commit after this transaction, and * therefore we can grab the min version so we can send all committed and rolled * back versions from min to current to remote nodes for re-ordering. * * @param entries Entries. * @param min Min version so far. * @param tx Transaction. * @return Minimal available version. */ private GridCacheVersion minVersion(Iterable<IgniteTxEntry> entries, GridCacheVersion min, IgniteInternalTx tx) { for (IgniteTxEntry txEntry : entries) { GridCacheEntryEx cached = txEntry.cached(); // We are assuming that this method is only called on commit. In that // case, if lock is held, entry can never be removed. assert txEntry.isRead() || !cached.obsolete(tx.xidVersion()) : "Invalid obsolete version for transaction [entry=" + cached + ", tx=" + tx + ']'; for (GridCacheMvccCandidate cand : cached.remoteMvccSnapshot()) if (min == null || cand.version().isLess(min)) min = cand.version(); } return min; }
if (!cached.obsolete()) { for (GridCacheMvccCandidate cand : cached.localCandidates()) { if (!cand.owner() && cand.version().compareTo(baseVer) < 0) {
if (entry.obsolete() || (storeErr != null && storeErr.failedKeys().contains(entry.key().value(ctx.cacheObjectContext(), false)))) continue;
/** {@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); }
entry.lockEntry(); if (!entry.obsolete()) break;
/** {@inheritDoc} */ @Override public void touch(GridCacheEntryEx e, AffinityTopologyVersion topVer) { 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(); } }
/** * @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); } } }
continue; if (e.cached().obsolete()) { GridCacheEntryEx cached = cacheCtx.cache().entryEx(e.key(), topologyVersion());