qSize += locs.size(); final Collection<GridCacheMvccCandidate> rmts = cached.remoteMvccSnapshot();
/** * 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; }
Collection<GridCacheMvccCandidate> rmtCands = entry.remoteMvccSnapshot();
/** * @throws Exception If failed. */ @Test public void testUnlockPrimaryLeft() throws Exception { GridCacheAdapter<Integer, Integer> cache = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME); Integer key = backupKey(grid(0).cache(DEFAULT_CACHE_NAME)); cache.lock(key, 0); stopGrid(1); cache.unlock(key); GridCacheEntryEx entry = cache.peekEx(key); assertTrue("Remote MVCC is not empty: " + entry, entry == null || entry.remoteMvccSnapshot().isEmpty()); startGrid(1); } }
for (GridCacheMvccCandidate c : prev.parent().remoteMvccSnapshot()) { if (c.version().equals(firstRmt.version())) { cand.setOwner();
assertFalse(entry.lockedByAny()); assertTrue(entry.localCandidates().isEmpty()); assertTrue(entry.remoteMvccSnapshot().isEmpty());
assertFalse(entry.lockedByAny()); assertTrue(entry.localCandidates().isEmpty()); assertTrue(entry.remoteMvccSnapshot().isEmpty());
qSize += locs.size(); final Collection<GridCacheMvccCandidate> rmts = cached.remoteMvccSnapshot();
/** * 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; }
for (GridCacheMvccCandidate c : prev.parent().remoteMvccSnapshot()) { if (c.version().equals(firstRmt.version())) { cand.setOwner();