You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/03/21 09:29:26 UTC

[1/2] ignite git commit: tmp

Repository: ignite
Updated Branches:
  refs/heads/ignite-4680-sb-1 [created] 9cc4612e3


tmp


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

Branch: refs/heads/ignite-4680-sb-1
Commit: a58a5db87806e5f814f6336c1f88eb1a8cdda88c
Parents: 956549e
Author: sboikov <sb...@gridgain.com>
Authored: Tue Mar 21 11:50:14 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Mar 21 11:50:14 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |  4 +-
 .../distributed/dht/GridDhtLocalPartition.java  | 80 +++++++++++++++++++-
 .../dht/atomic/GridDhtAtomicCache.java          | 22 +-----
 3 files changed, 83 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a58a5db8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 54b4ed7..77612b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2050,7 +2050,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
         Long updateCntr0 = null;
 
-        synchronized (this) {
+        //synchronized (this) {
             boolean internal = isInternal() || !context().userCache();
 
             Map<UUID, CacheContinuousQueryListener> lsnrs = cctx.continuousQueries().updateListeners(internal, false);
@@ -2705,7 +2705,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 assert rmv;
             }
-        }
+       // }
 
         if (log.isDebugEnabled())
             log.debug("Updated cache entry [val=" + val + ", old=" + oldVal + ", entry=" + this + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/a58a5db8/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 693a049..99fdc87 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
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
@@ -130,7 +131,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
      * @param entryFactory Entry factory.
      */
     @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
-    GridDhtLocalPartition(GridCacheContext cctx, int id, GridCacheMapEntryFactory entryFactory) {
+    GridDhtLocalPartition(final GridCacheContext cctx, int id, final GridCacheMapEntryFactory entryFactory) {
         assert cctx != null;
 
         this.id = id;
@@ -144,7 +145,82 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
             }
         };
 
-        map = new GridCacheConcurrentMapImpl(cctx, entryFactory, cctx.config().getStartSize() / cctx.affinity().partitions());
+        //map = new GridCacheConcurrentMapImpl(cctx, entryFactory, cctx.config().getStartSize() / cctx.affinity().partitions());
+
+        map = new GridCacheConcurrentMap() {
+            private final HashMap<KeyCacheObject, GridCacheMapEntry> m = new HashMap<>();
+
+            @Nullable
+            @Override
+            public GridCacheMapEntry getEntry(KeyCacheObject key) {
+                return m.get(key);
+            }
+
+            @Nullable
+            @Override
+            public GridCacheMapEntry putEntryIfObsoleteOrAbsent(AffinityTopologyVersion topVer,
+                                                                KeyCacheObject key,
+                                                                @Nullable CacheObject val,
+                                                                boolean create,
+                                                                boolean touch) {
+                GridCacheMapEntry e = entryFactory.create(cctx, topVer, key, 0, val);
+
+                m.put(key, e);
+
+                return e;
+            }
+
+            @Override
+            public boolean removeEntry(GridCacheEntryEx entry) {
+                return m.remove(entry.key()) != null;
+            }
+
+            @Override
+            public int size() {
+                return m.size();
+            }
+
+            @Override
+            public int publicSize() {
+                return m.size();
+            }
+
+            @Override
+            public void incrementPublicSize(GridCacheEntryEx e) {
+
+            }
+
+            @Override
+            public void decrementPublicSize(GridCacheEntryEx e) {
+
+            }
+
+            @Nullable
+            @Override
+            public GridCacheMapEntry randomEntry() {
+                return null;
+            }
+
+            @Override
+            public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter) {
+                return m.keySet();
+            }
+
+            @Override
+            public Iterable<GridCacheMapEntry> entries(CacheEntryPredicate... filter) {
+                return m.values();
+            }
+
+            @Override
+            public Iterable<GridCacheMapEntry> allEntries(CacheEntryPredicate... filter) {
+                return m.values();
+            }
+
+            @Override
+            public Set<GridCacheMapEntry> entrySet(CacheEntryPredicate... filter) {
+                return new HashSet<>(m.values());
+            }
+        };
 
         int delQueueSize = CU.isSystemCache(cctx.name()) ? 100 :
             Math.max(MAX_DELETE_QUEUE_SIZE / cctx.affinity().partitions(), 20);

http://git-wip-us.apache.org/repos/asf/ignite/blob/a58a5db8/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 feed87f..51e40f4 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
@@ -1860,19 +1860,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                 e.printStackTrace();
             }
-            finally {
-                if (locked != null)
-                    unlockEntries(locked, req.topologyVersion());
-
-                // Enqueue if necessary after locks release.
-                if (deleted != null) {
-                    assert !deleted.isEmpty();
-                    assert ctx.deferredDelete() : this;
-
-                    for (IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion> e : deleted)
-                        ctx.onDeferredDelete(e.get1(), e.get2());
-                }
-            }
         }
         catch (GridDhtInvalidPartitionException ignore) {
             if (log.isDebugEnabled())
@@ -1931,7 +1918,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             false,
             ctx.deploymentEnabled());
 
-        List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion(), stripeIdxs);
+        //List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion(), stripeIdxs);
 
         boolean hasNear = ctx.discovery().cacheNearNode(node, name());
 
@@ -1960,7 +1947,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             hasNear,
             req,
             res,
-            locked,
             ver,
             null,
             ctx.isDrEnabled(),
@@ -1976,7 +1962,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
         res.returnValue(retVal);
 
-        unlockEntries(locked, null);
+        //unlockEntries(locked, null);
 
         if (TEST_STRIPE_SUBMIT){
             for (int i = 0; i < req.size(); i++) {
@@ -2471,7 +2457,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param hasNear {@code True} if originating node has near cache.
      * @param req Update request.
      * @param res Update response.
-     * @param locked Locked entries.
      * @param ver Assigned update version.
      * @param dhtFut Optional DHT future.
      * @param replicate Whether DR is enabled for that cache.
@@ -2488,7 +2473,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         boolean hasNear,
         GridNearAtomicAbstractUpdateRequest req,
         GridNearAtomicUpdateResponse res,
-        List<GridDhtCacheEntry> locked,
         GridCacheVersion ver,
         @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
         boolean replicate,
@@ -2519,7 +2503,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             // We are holding java-level locks on entries at this point.
             // No GridCacheEntryRemovedException can be thrown.
             try {
-                GridDhtCacheEntry entry = locked.get(i);
+                GridDhtCacheEntry entry = entryExx(k, topVer);
 
                 GridCacheVersion newConflictVer = req.conflictVersion(trueIdx);
                 long newConflictTtl = req.conflictTtl(trueIdx);


[2/2] ignite git commit: Merge branch 'ignite-4680-sb' into ignite-4680-sb-1

Posted by sb...@apache.org.
Merge branch 'ignite-4680-sb' into ignite-4680-sb-1

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java


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

Branch: refs/heads/ignite-4680-sb-1
Commit: 9cc4612e3ec2754f6219048b4a71452575c7e0dc
Parents: a58a5db 6187b1f
Author: sboikov <sb...@gridgain.com>
Authored: Tue Mar 21 12:19:43 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Mar 21 12:19:43 2017 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 59 +++++++-------
 .../GridNearAtomicAbstractUpdateRequest.java    | 37 +++++----
 .../dht/atomic/NearAtomicResponseHelper.java    | 82 --------------------
 3 files changed, 48 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9cc4612e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 51e40f4,542071a..a118f31
--- 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
@@@ -1911,23 -1921,10 +1908,8 @@@ public class GridDhtAtomicCache<K, V> e
          GridNearAtomicAbstractUpdateRequest req,
          int[] stripeIdxs,
          UpdateReplyClosure completionCb) throws GridCacheEntryRemovedException {
-         GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(),
-             node.id(),
-             req.futureId(),
-             req.partition(),
-             false,
-             ctx.deploymentEnabled());
- 
-         //List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion(), stripeIdxs);
 -        List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion(), stripeIdxs);
--
          boolean hasNear = ctx.discovery().cacheNearNode(node, name());
  
-         // Assign next version for update inside entries lock.
-         //if (ver == null)
- 
-         if (hasNear)
-             res.nearVersion(ver);
- 
          if (msgLog.isDebugEnabled()) {
              msgLog.debug("Assigned update version [futId=" + req.futureId() +
                  ", writeVer=" + ver + ']');
@@@ -1946,7 -1943,8 +1928,7 @@@
              node,
              hasNear,
              req,
-             res,
+             null,
 -            locked,
              ver,
              null,
              ctx.isDrEnabled(),
@@@ -1960,11 -1958,21 +1942,19 @@@
          if (retVal == null)
              retVal = new GridCacheReturn(ctx, node.isLocal(), true, null, true);
  
-         res.returnValue(retVal);
 -        unlockEntries(locked, null);
 -
+         if (TEST_STRIPE_SUBMIT){
+             GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(),
+                 node.id(),
+                 req.futureId(),
+                 req.partition(),
+                 false,
+                 ctx.deploymentEnabled());
+ 
+             if (hasNear)
+                 res.nearVersion(ver);
  
-         //unlockEntries(locked, null);
+             res.returnValue(retVal);
  
-         if (TEST_STRIPE_SUBMIT){
              for (int i = 0; i < req.size(); i++) {
                  fut.addWriteEntry(affinityAssignment,
                      req.key(i),