ignite-1048 create/lock entries before topology read lock
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be881a36 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be881a36 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be881a36 Branch: refs/heads/ignite-1026 Commit: be881a367ef02a724c2b84aba8f72c6effadc2b2 Parents: 1c66078 Author: sboikov <sboi...@gridgain.com> Authored: Tue Jun 23 10:52:47 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Tue Jun 23 10:52:47 2015 +0300 ---------------------------------------------------------------------- .../cache/distributed/dht/GridDhtLocalPartition.java | 3 ++- .../cache/distributed/dht/atomic/GridDhtAtomicCache.java | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be881a36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java index 3a577a7..87c7f0e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java @@ -236,7 +236,8 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>, void onAdded(GridDhtCacheEntry entry) { GridDhtPartitionState state = state(); - assert state != EVICTED : "Adding entry to invalid partition: " + this; + if (state == EVICTED) + throw new GridDhtInvalidPartitionException(id, "Adding entry to invalid partition [part=" + id + ']'); map.put(entry.key(), entry); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be881a36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index 8630421..7bec302 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -1028,7 +1028,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { IgniteCacheExpiryPolicy expiry = null; try { - List<GridDhtCacheEntry> locked = null; + // If batch store update is enabled, we need to lock all entries. + // First, need to acquire locks on cache entries, then check filter. + List<GridDhtCacheEntry> locked = lockEntries(keys, req.topologyVersion()); + Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null; try { @@ -1058,10 +1061,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { return; } - // If batch store update is enabled, we need to lock all entries. - // First, need to acquire locks on cache entries, then check filter. - locked = lockEntries(keys, req.topologyVersion()); - boolean hasNear = ctx.discovery().cacheNearNode(node, name()); GridCacheVersion ver = req.updateVersion();