ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [06/50] [abbrv] incubator-ignite git commit: # ignite-560
Date Tue, 14 Apr 2015 14:25:22 GMT
# ignite-560


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

Branch: refs/heads/ignite-218
Commit: 03025deef0a5efd9ff2da1105a0d513a189ec2c2
Parents: fceebf2
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Apr 13 11:01:06 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Apr 13 11:10:14 2015 +0300

----------------------------------------------------------------------
 .../distributed/near/GridNearCacheEntry.java    |  6 ++--
 .../junits/common/GridCommonAbstractTest.java   | 36 +++++++++++++++++++-
 2 files changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/03025dee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
index b22f79f..742900b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -157,7 +157,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
                                 // Version does not change for load ops.
                                 update(e.value(), e.expireTime(), e.ttl(), e.isNew() ? ver
: e.version());
 
-                                if (cctx.deferredDelete()) {
+                                if (cctx.deferredDelete() && !isNew() &&
!isInternal()) {
                                     boolean deleted = val == null;
 
                                     if (deleted != deletedUnlocked()) {
@@ -196,6 +196,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
      * @param ver Version.
      * @param dhtVer DHT version.
      * @param primaryNodeId Primary node ID.
+     * @param topVer Topology version.
      * @return {@code True} if reset was done.
      * @throws GridCacheEntryRemovedException If obsolete.
      * @throws IgniteCheckedException If failed.
@@ -238,6 +239,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
      * @param expireTime Expire time.
      * @param ttl Time to live.
      * @param primaryNodeId Primary node ID.
+     * @param topVer Topology version.
      */
     public void updateOrEvict(GridCacheVersion dhtVer,
         @Nullable CacheObject val,
@@ -382,7 +384,7 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
                     if (!dhtVer.equals(dhtVersion())) {
                         update(val, expireTime, ttl, ver);
 
-                        if (cctx.deferredDelete()) {
+                        if (cctx.deferredDelete() && !isInternal()) {
                             boolean deleted = val == null;
 
                             if (deleted != deletedUnlocked()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/03025dee/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 98822f0..5533897 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -784,7 +784,16 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @return Near cache for key.
      */
     protected IgniteCache<Integer, Integer> primaryCache(Integer key, String cacheName)
{
-        return primaryNode(key, null).cache(null);
+        return primaryNode(key, cacheName).cache(cacheName);
+    }
+
+    /**
+     * @param key Key.
+     * @param cacheName Cache name.
+     * @return Near cache for key.
+     */
+    protected IgniteCache<Integer, Integer> backupCache(Integer key, String cacheName)
{
+        return backupNode(key, cacheName).cache(cacheName);
     }
 
     /**
@@ -809,6 +818,31 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
+     * @param key Key.
+     * @param cacheName Cache name.
+     * @return Ignite instance which has primary cache for given key.
+     */
+    protected Ignite backupNode(Object key, String cacheName) {
+        List<Ignite> allGrids = Ignition.allGrids();
+
+        assertFalse("There are no alive nodes.", F.isEmpty(allGrids));
+
+        Ignite ignite = allGrids.get(0);
+
+        Affinity<Object> aff = ignite.affinity(cacheName);
+
+        Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(key);
+
+        assertTrue("Expected more than one node for key [key=" + key + ", nodes=" + nodes
+']', nodes.size() > 1);
+
+        Iterator<ClusterNode> it = nodes.iterator();
+
+        it.next(); // Skip primary.
+
+        return grid(it.next());
+    }
+
+    /**
      * In ATOMIC cache with CLOCK mode if key is updated from different nodes at same time
      * only one update wins others are ignored (can happen in test event when updates are
executed from
      * different nodes sequentially), this delay is used to avoid lost updates.


Mime
View raw message