More correct way to acquire checkpoint read lock
@@ -942,17 +942,14 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
GridIterator<CacheDataRow> it0 = cctx.offheap().iterator(id);
while (it0.hasNext()) {
- cctx.shared().database().checkpointReadLock();
-
try {
CacheDataRow row = it0.next();
- GridDhtCacheEntry cached = (GridDhtCacheEntry) getEntry(row.key());
+ GridDhtCacheEntry cached = (GridDhtCacheEntry)cctx.cache().entryEx(row.key());
- if (cached == null || cached.obsolete())
- cached = (GridDhtCacheEntry) putEntryIfObsoleteOrAbsent(
- cctx.affinity().affinityTopologyVersion(), row.key(), null, true, false);
+ cctx.shared().database().checkpointReadLock();
+ try {
if (cached.clearInternal(clearVer, extras)) {
if (rec) {
cctx.events().addEvent(cached.partition(),
@@ -972,14 +969,15 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
}
}
}
+ finally {
+ cctx.shared().database().checkpointReadUnlock();
+ }
+ }
catch (GridDhtInvalidPartitionException e) {
assert isEmpty() && state() == EVICTED : "Invalid error [e=" + e + ", part=" + this + ']';
break; // Partition is already concurrently cleared and evicted.
}
- finally {
- cctx.shared().database().checkpointReadUnlock();
- }
}
}
catch (NodeStoppingException e) {
