ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [17/18] ignite git commit: IGNITE-2263: DANGEROUS!!! Several easy places.
Date Fri, 01 Jan 2016 21:07:44 GMT
IGNITE-2263: DANGEROUS!!! Several easy places.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/083b4eb0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/083b4eb0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/083b4eb0

Branch: refs/heads/ignite-2263
Commit: 083b4eb0f392ae731387cad769ba63066e13d461
Parents: 80f15a7
Author: thatcoach <ppozerov@list.ru>
Authored: Fri Jan 1 23:59:58 2016 +0300
Committer: thatcoach <ppozerov@list.ru>
Committed: Fri Jan 1 23:59:58 2016 +0300

----------------------------------------------------------------------
 .../cache/GridCacheMvccCandidate.java           | 52 +++++++++-------
 .../processors/cache/GridCacheMvccManager.java  | 37 +++++++-----
 .../GridCachePartitionExchangeManager.java      | 63 +++++++++-----------
 3 files changed, 80 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/083b4eb0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
index aba8318..9ce2189 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
@@ -17,14 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
@@ -39,16 +31,16 @@ import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.DHT_LOCAL;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.LOCAL;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.NEAR_LOCAL;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.OWNER;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.READY;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.REENTRY;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.REMOVED;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.SINGLE_IMPLICIT;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.TX;
-import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.USED;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate.Mask.*;
 
 /**
  * Lock candidate.
@@ -336,11 +328,27 @@ public class GridCacheMvccCandidate implements Externalizable,
      * @param node Node to remove.
      */
     public void removeMappedNode(ClusterNode node) {
-        if (mappedDhtNodes.contains(node))
-            mappedDhtNodes = new ArrayList<>(F.view(mappedDhtNodes, F.notEqualTo(node)));
+        if (mappedDhtNodes.contains(node)) {
+            ArrayList<ClusterNode> tmp = new ArrayList<>(mappedDhtNodes.size()
- 1);
+
+            for (ClusterNode dhtNode : mappedDhtNodes) {
+                if (!F.eq(dhtNode, node))
+                    tmp.add(dhtNode);
+            }
 
-        if (mappedNearNodes != null && mappedNearNodes.contains(node))
-            mappedNearNodes = new ArrayList<>(F.view(mappedNearNodes, F.notEqualTo(node)));
+            mappedDhtNodes = tmp;
+        }
+
+        if (mappedNearNodes != null && mappedNearNodes.contains(node)) {
+            ArrayList<ClusterNode> tmp = new ArrayList<>(mappedNearNodes.size()
- 1);
+
+            for (ClusterNode nearNode : mappedNearNodes) {
+                if (!F.eq(nearNode, node))
+                    tmp.add(nearNode);
+            }
+
+            mappedNearNodes = tmp;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/083b4eb0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index dbc6992..cc57c47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -17,17 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ConcurrentMap;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.events.DiscoveryEvent;
@@ -63,10 +52,21 @@ import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 import org.jsr166.ConcurrentLinkedDeque8;
 
-import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
-import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
-import static org.apache.ignite.internal.util.GridConcurrentFactory.newMap;
-import static org.jsr166.ConcurrentLinkedHashMap.QueuePolicy.PER_SEGMENT_Q;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
+
+import static org.apache.ignite.events.EventType.*;
+import static org.apache.ignite.internal.util.GridConcurrentFactory.*;
+import static org.jsr166.ConcurrentLinkedHashMap.QueuePolicy.*;
 
 /**
  * Manages lock order within a thread.
@@ -1094,9 +1094,14 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter
{
                     Collection<GridCacheMvccCandidate> locs = entry.localCandidates();
 
                     if (!F.isEmpty(locs)) {
+                        IgnitePredicate<GridCacheMvccCandidate> verFilter = versionFilter();
+
                         Collection<GridCacheMvccCandidate> cands = new ConcurrentLinkedQueue<>();
 
-                        cands.addAll(F.view(locs, versionFilter()));
+                        for (GridCacheMvccCandidate loc : locs) {
+                            if (verFilter.apply(loc))
+                                cands.add(loc);
+                        }
 
                         if (!F.isEmpty(cands))
                             pendingLocks.put(entry.txKey(), cands);

http://git-wip-us.apache.org/repos/asf/ignite/blob/083b4eb0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 4732597..13fd94f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -17,26 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.Queue;
-import java.util.TreeMap;
-import java.util.UUID;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
@@ -88,19 +68,34 @@ import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 import org.jsr166.ConcurrentLinkedDeque8;
 
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_AFFINITY_HISTORY_SIZE;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_PRELOAD_RESEND_TIMEOUT;
-import static org.apache.ignite.IgniteSystemProperties.getInteger;
-import static org.apache.ignite.IgniteSystemProperties.getLong;
-import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_STARTED;
-import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
-import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
-import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
-import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
-import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader.DFLT_PRELOAD_RESEND_TIMEOUT;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.Queue;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import static java.util.concurrent.TimeUnit.*;
+import static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.events.EventType.*;
+import static org.apache.ignite.internal.GridTopic.*;
+import static org.apache.ignite.internal.events.DiscoveryCustomEvent.*;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader.*;
 
 /**
  * Partition exchange manager.
@@ -1279,7 +1274,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                         };
 
                         log.debug("Before waiting for exchange futures [futs" +
-                            F.view(exchFuts.values(), p) + ", worker=" + this + ']');
+                            F.retain(exchFuts.values(), true, p) + ", worker=" + this + ']');
                     }
 
                     // Take next exchange future.


Mime
View raw message