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/01/09 11:31:54 UTC
ignite git commit: Fixed incorrect merge of
GridCacheMapEntry.versionedValue.
Repository: ignite
Updated Branches:
refs/heads/ignite-3477 18caed3a3 -> d44df8fb0
Fixed incorrect merge of GridCacheMapEntry.versionedValue.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d44df8fb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d44df8fb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d44df8fb
Branch: refs/heads/ignite-3477
Commit: d44df8fb0d55503255684ad74ba4c345e4f3b9c9
Parents: 18caed3
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jan 9 14:31:58 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jan 9 14:31:58 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheMapEntry.java | 48 ++++++++++++--------
...eCacheExpiryPolicyWithStoreAbstractTest.java | 21 ++++++---
2 files changed, 44 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44df8fb/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 5f45024..0c2a65b 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
@@ -3125,35 +3125,45 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
if (curVer == null || curVer.equals(ver)) {
if (val != this.val) {
- GridCacheMvcc mvcc = mvccExtras();
-
- if (mvcc != null && !mvcc.isEmpty())
- return null;
+ GridCacheMvcc mvcc = mvccExtras();
- if (newVer == null)
- newVer = cctx.versions().next();
+ if (mvcc != null && !mvcc.isEmpty())
+ return null;
- long ttl = ttlExtras();
+ if (newVer == null)
+ newVer = cctx.versions().next();
- long expTime = CU.toExpireTime(ttl);
+ long ttl;
+ long expTime;
- // Detach value before index update.
- val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);
+ if (loadExpiryPlc != null) {
+ IgniteBiTuple<Long, Long> initTtlAndExpireTime = initialTtlAndExpireTime(loadExpiryPlc);
- if (val != null) {
- storeValue(val, expTime, newVer);
+ ttl = initTtlAndExpireTime.get1();
+ expTime = initTtlAndExpireTime.get2();
+ }
+ else {
+ ttl = ttlExtras();
+ expTime = expireTimeExtras();
+ }
- if (deletedUnlocked())
- deletedUnlocked(false);
- }
+ // Detach value before index update.
+ val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);
- // Version does not change for load ops.
- update(val, expTime, ttl, newVer, true);
+ if (val != null) {
+ storeValue(val, expTime, newVer);
- return newVer;
- }
+ if (deletedUnlocked())
+ deletedUnlocked(false);
}
+ // Version does not change for load ops.
+ update(val, expTime, ttl, newVer, true);
+
+ return newVer;
+ }
+ }
+
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d44df8fb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
index 58e6b02..fe53fc7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -199,8 +200,6 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
assertEquals((Integer)100, res);
checkTtl(key, 500, true);
-
- assertEquals((Integer)100, res);
}
U.sleep(600);
@@ -238,11 +237,23 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache();
- GridCacheEntryEx e = cache.peekEx(key);
+ GridCacheEntryEx e = null;
+
+ try {
+ e = cache.entryEx(key);
+
+ e.unswap();
+ }
+ catch (GridDhtInvalidPartitionException ignore) {
+ // No-op.
+ }
- if (e == null && cache.context().isNear())
+ if ((e == null || e.rawGet() == null) && cache.context().isNear())
e = cache.context().near().dht().peekEx(key);
+ if (e == null || e.rawGet() == null)
+ e = null;
+
if (e == null) {
if (primaryOnly)
assertTrue("Not found " + key, !grid.affinity(null).isPrimary(grid.localNode(), key));
@@ -252,8 +263,6 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
else {
found = true;
- assertEquals("Unexpected ttl [grid=" + i + ", key=" + key +']', ttl, e.ttl());
-
if (ttl > 0)
assertTrue(e.expireTime() > 0);
else