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 2016/06/07 12:02:10 UTC
ignite git commit: ignite-114
Repository: ignite
Updated Branches:
refs/heads/ignite-114 [created] 54dc05a3a
ignite-114
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54dc05a3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54dc05a3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54dc05a3
Branch: refs/heads/ignite-114
Commit: 54dc05a3aeb5080c441aa14ccd577f417baa8d8d
Parents: 065d2e7
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 7 11:46:32 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 7 15:01:09 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 24 +-
.../processors/cache/GridCacheEntryEx.java | 5 -
.../processors/cache/GridCacheMapEntry.java | 104 ++++----
.../processors/cache/GridCacheUtils.java | 3 +
.../dht/GridDhtTransactionalCacheAdapter.java | 2 -
.../distributed/dht/GridDhtTxPrepareFuture.java | 20 +-
.../dht/GridPartitionedGetFuture.java | 2 -
.../dht/GridPartitionedSingleGetFuture.java | 2 -
.../dht/atomic/GridDhtAtomicCache.java | 8 -
.../dht/colocated/GridDhtColocatedCache.java | 2 -
.../distributed/near/GridNearGetFuture.java | 4 -
.../local/atomic/GridLocalAtomicCache.java | 8 -
.../cache/transactions/IgniteTxAdapter.java | 2 -
.../cache/transactions/IgniteTxEntry.java | 24 +-
.../transactions/IgniteTxLocalAdapter.java | 24 +-
.../processors/cache/GridCacheTestEntryEx.java | 2 -
.../cache/IgniteCacheAbstractTest.java | 2 +-
...gniteCacheInvokeReadThroughAbstractTest.java | 236 +++++++++++++++++++
...iteCacheInvokeReadThroughSingleNodeTest.java | 76 ++++++
.../cache/IgniteCacheInvokeReadThroughTest.java | 120 ++++------
.../IgniteCacheLoaderWriterAbstractTest.java | 10 +
.../testsuites/IgniteCacheTestSuite4.java | 2 +
22 files changed, 477 insertions(+), 205 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 6ccb506..f931c50 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -5102,19 +5102,17 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
throws IgniteCheckedException, GridCacheEntryRemovedException
{
CacheObject val = entry.innerGet(
- null,
- null,
- false,
- false,
- false,
- true,
- false,
- false,
- false,
- null,
- null,
- null,
- null,
+ /*ver*/null,
+ /*tx*/null,
+ /*swap*/false,
+ /*readThrough*/false,
+ /*metrics*/false,
+ /*evt*/false,
+ /*tmp*/false,
+ /*subjId*/null,
+ /*transformClo*/null,
+ /*taskName*/null,
+ /*expiryPlc*/null,
!deserializeBinary);
if (val == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 31bd887..8567f77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -278,9 +278,6 @@ public interface GridCacheEntryEx {
* @param tx Ongoing transaction (possibly null).
* @param readSwap Flag indicating whether to check swap memory.
* @param readThrough Flag indicating whether to read through.
- * @param failFast If {@code true}, then throw {@link GridCacheFilterFailedException} if
- * filter didn't pass.
- * @param unmarshal Unmarshal flag.
* @param updateMetrics If {@code true} then metrics should be updated.
* @param evt Flag to signal event notification.
* @param tmp If {@code true} can return temporary instance which is valid while entry lock is held,
@@ -299,8 +296,6 @@ public interface GridCacheEntryEx {
@Nullable IgniteInternalTx tx,
boolean readSwap,
boolean readThrough,
- boolean failFast,
- boolean unmarshal,
boolean updateMetrics,
boolean evt,
boolean tmp,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/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 f442202..1c5953a 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
@@ -750,8 +750,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
@Nullable IgniteInternalTx tx,
boolean readSwap,
boolean readThrough,
- boolean failFast,
- boolean unmarshal,
boolean updateMetrics,
boolean evt,
boolean tmp,
@@ -766,7 +764,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
readSwap,
readThrough,
evt,
- unmarshal,
updateMetrics,
tmp,
subjId,
@@ -796,7 +793,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
readSwap,
false,
evt,
- unmarshal,
updateMetrics,
false,
subjId,
@@ -815,7 +811,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
boolean readSwap,
boolean readThrough,
boolean evt,
- boolean unmarshal,
boolean updateMetrics,
boolean tmp,
UUID subjId,
@@ -1007,6 +1002,15 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
if (cctx.deferredDelete() && deletedUnlocked() && !isInternal() && !detached())
deletedUnlocked(false);
+
+ if (tx != null) {
+ IgniteTxEntry e = tx.entry(cctx.txKey(key));
+
+ assert e != null : this;
+
+ if (e != null)
+ e.valueReadFromStore(true);
+ }
}
if (evt && cctx.events().isRecordable(EVT_CACHE_OBJECT_READ))
@@ -1985,6 +1989,51 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
if (isStartVersion())
unswap(retval, false);
+ // Prepare old value.
+ oldVal = needVal ? rawGetOrUnmarshalUnlocked(!retval && !isOffHeapValuesOnly()) : val;
+
+ // Possibly read value from store.
+ boolean readFromStore = false;
+
+ Object old0 = null;
+
+ if (readThrough && needVal && oldVal == null && (cctx.readThrough() &&
+ (op == GridCacheOperation.TRANSFORM || cctx.loadPreviousValue()))) {
+ old0 = readThrough(null, key, false, subjId, taskName);
+
+ oldVal = cctx.toCacheObject(old0);
+
+ readFromStore = true;
+
+ // Detach value before index update.
+ oldVal = cctx.kernalContext().cacheObjects().prepareForCache(oldVal, cctx);
+
+ // Calculate initial TTL and expire time.
+ long initTtl;
+ long initExpireTime;
+
+ if (expiryPlc != null && oldVal != null) {
+ IgniteBiTuple<Long, Long> initTtlAndExpireTime = initialTtlAndExpireTime(expiryPlc);
+
+ initTtl = initTtlAndExpireTime.get1();
+ initExpireTime = initTtlAndExpireTime.get2();
+ }
+ else {
+ initTtl = CU.TTL_ETERNAL;
+ initExpireTime = CU.EXPIRE_TIME_ETERNAL;
+ }
+
+ if (oldVal != null)
+ updateIndex(oldVal, initExpireTime, ver, null);
+ else
+ clearIndex(null);
+
+ update(oldVal, initExpireTime, initTtl, ver, true);
+
+ if (deletedUnlocked() && oldVal != null && !isInternal())
+ deletedUnlocked(false);
+ }
+
Object transformClo = null;
// Request-level conflict resolution is needed, i.e. we do not know who will win in advance.
@@ -2192,51 +2241,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
"Invalid version for inner update [isNew=" + isNew() + ", entry=" + this + ", newVer=" + newVer + ']';
}
- // Prepare old value and value bytes.
- oldVal = needVal ? rawGetOrUnmarshalUnlocked(!retval && !isOffHeapValuesOnly()) : val;
-
- // Possibly read value from store.
- boolean readFromStore = false;
-
- Object old0 = null;
-
- if (readThrough && needVal && oldVal == null && (cctx.readThrough() &&
- (op == GridCacheOperation.TRANSFORM || cctx.loadPreviousValue()))) {
- old0 = readThrough(null, key, false, subjId, taskName);
-
- oldVal = cctx.toCacheObject(old0);
-
- readFromStore = true;
-
- // Detach value before index update.
- oldVal = cctx.kernalContext().cacheObjects().prepareForCache(oldVal, cctx);
-
- // Calculate initial TTL and expire time.
- long initTtl;
- long initExpireTime;
-
- if (expiryPlc != null && oldVal != null) {
- IgniteBiTuple<Long, Long> initTtlAndExpireTime = initialTtlAndExpireTime(expiryPlc);
-
- initTtl = initTtlAndExpireTime.get1();
- initExpireTime = initTtlAndExpireTime.get2();
- }
- else {
- initTtl = CU.TTL_ETERNAL;
- initExpireTime = CU.EXPIRE_TIME_ETERNAL;
- }
-
- if (oldVal != null)
- updateIndex(oldVal, initExpireTime, ver, null);
- else
- clearIndex(null);
-
- update(oldVal, initExpireTime, initTtl, ver, true);
-
- if (deletedUnlocked() && oldVal != null && !isInternal())
- deletedUnlocked(false);
- }
-
// Apply metrics.
if (metrics && cctx.cache().configuration().isStatisticsEnabled() && needVal) {
// PutIfAbsent methods mustn't update hit/miss statistics
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 6ce5735..ed63f91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -155,6 +155,9 @@ public class GridCacheUtils {
/** Keep serialized flag. */
public static final int KEEP_BINARY_FLAG_MASK = 0x2;
+ /** Read from store flag. */
+ public static final int READ_FROM_STORE_FLAG_MASK = 0x4;
+
/** Empty predicate array. */
private static final IgnitePredicate[] EMPTY = new IgnitePredicate[0];
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index b2da39c..0ca02c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -1181,8 +1181,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
tx,
/*swap*/true,
/*read-through*/false,
- /*fail-fast.*/false,
- /*unmarshal*/false,
/*update-metrics*/true,
/*event notification*/req.returnValue(i),
/*temporary*/false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index e17cbbc..8271bc5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -333,9 +333,9 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
if (hasFilters || retVal || txEntry.op() == DELETE || txEntry.op() == TRANSFORM) {
cached.unswap(retVal);
- boolean readThrough = (retVal || hasFilters) &&
- cacheCtx.config().isLoadPreviousValue() &&
- !txEntry.skipStore();
+ boolean readThrough = !txEntry.skipStore() &&
+ (txEntry.op() == TRANSFORM) ||
+ ((retVal || hasFilters) && cacheCtx.config().isLoadPreviousValue());
boolean evt = retVal || txEntry.op() == TRANSFORM;
@@ -351,8 +351,6 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
tx,
/*swap*/true,
readThrough,
- /*fail fast*/false,
- /*unmarshal*/true,
/*metrics*/retVal,
/*event*/evt,
/*tmp*/false,
@@ -1327,10 +1325,16 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
GridDistributedTxMapping global = globalMap.get(n.id());
if (!F.isEmpty(entry.entryProcessors())) {
- GridDhtPartitionState state = entry.context().topology().partitionState(n.id(),
- entry.cached().partition());
+ boolean sndVal = entry.valueReadFromStore();
- if (state != GridDhtPartitionState.OWNING && state != GridDhtPartitionState.EVICTED) {
+ if (!sndVal) {
+ GridDhtPartitionState state = entry.context().topology().partitionState(n.id(),
+ entry.cached().partition());
+
+ sndVal = state != GridDhtPartitionState.OWNING && state != GridDhtPartitionState.EVICTED;
+ }
+
+ if (sndVal) {
T2<GridCacheOperation, CacheObject> procVal = entry.entryProcessorCalculatedValue();
assert procVal != null : entry;
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 7d2c5db..b3a485c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -473,8 +473,6 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
null,
/*swap*/true,
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/**update-metrics*/false,
/*event*/!skipVals,
/*temporary*/false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index b0b9d7c..7788b63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -397,8 +397,6 @@ public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object> im
null,
/*swap*/true,
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/**update-metrics*/false,
/*event*/!skipVals,
/*temporary*/false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/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 08f1f30..ad87add 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
@@ -1219,8 +1219,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
null,
/*swap*/true,
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/**update-metrics*/false,
/*event*/!skipVals,
/*temporary*/false,
@@ -1695,8 +1693,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
null,
/*read swap*/true,
/*read through*/true,
- /*fail fast*/false,
- /*unmarshal*/true,
/*metrics*/true,
/*event*/true,
/*temporary*/true,
@@ -1855,8 +1851,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
null,
/*read swap*/true,
/*read through*/ctx.loadPreviousValue(),
- /*fail fast*/false,
- /*unmarshal*/true,
/*metrics*/true,
/*event*/true,
/*temporary*/true,
@@ -1902,8 +1896,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
null,
/*read swap*/true,
/*read through*/ctx.loadPreviousValue(),
- /*fail fast*/false,
- /*unmarshal*/true,
/*metrics*/true,
/*event*/true,
/*temporary*/true,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 35831a3..1113270 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -507,8 +507,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
null,
/*swap*/true,
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/**update-metrics*/false,
/*event*/!skipVals,
/*temporary*/false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index edac92c..73b9d38 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -457,8 +457,6 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
tx,
/*swap*/false,
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/*metrics*/true,
/*events*/!skipVals,
/*temporary*/false,
@@ -599,8 +597,6 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
tx,
/*swap*/true,
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/*update-metrics*/false,
/*events*/!nearRead && !skipVals,
/*temporary*/false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index d2d8d62..7caea23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -628,8 +628,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
null,
/*swap*/swapOrOffheap,
/*read-through*/false,
- /*fail-fast*/false,
- /*unmarshal*/true,
/**update-metrics*/true,
/**event*/!skipVals,
/**temporary*/false,
@@ -1187,8 +1185,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
null,
/*swap*/true,
/*read-through*/true,
- /*fail-fast*/false,
- /*unmarshal*/true,
/**update-metrics*/true,
/**event*/true,
/**temporary*/true,
@@ -1311,8 +1307,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
null,
/*swap*/true,
/*read-through*/ctx.loadPreviousValue(),
- /*fail-fast*/false,
- /*unmarshal*/true,
/**update-metrics*/true,
/**event*/true,
/**temporary*/true,
@@ -1348,8 +1342,6 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
null,
/*swap*/true,
/*read-through*/ctx.loadPreviousValue(),
- /*fail-fast*/false,
- /*unmarshal*/true,
/**update-metrics*/true,
/**event*/true,
/**temporary*/true,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 66d4df0..3bb3a17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1492,8 +1492,6 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
this,
/*swap*/false,
/*read through*/false,
- /*fail fast*/true,
- /*unmarshal*/true,
/*metrics*/metrics,
/*event*/recordEvt,
/*temporary*/true,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 90aa8d2..037eca2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.GridCacheOperation;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.GridCacheUtils;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -57,6 +58,7 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.READ;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.KEEP_BINARY_FLAG_MASK;
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.READ_FROM_STORE_FLAG_MASK;
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.SKIP_STORE_FLAG_MASK;
/**
@@ -185,9 +187,11 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
private byte[] expiryPlcBytes;
/**
- * Additional flags.
- * GridCacheUtils.SKIP_STORE_FLAG_MASK - for skipStore flag value.
- * GridCacheUtils.KEEP_BINARY_FLAG_MASK - for withKeepBinary flag.
+ * Additional flags:
+ * <ul>
+ * <li>{@link GridCacheUtils#SKIP_STORE_FLAG_MASK} - for skipStore flag value.</li>
+ * <li>{@link GridCacheUtils#KEEP_BINARY_FLAG_MASK} - for withKeepBinary flag.</li>
+ * </ul>
*/
private byte flags;
@@ -483,6 +487,20 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
}
/**
+ * @param readFromStore Flag indicating whether entry value was read from store.
+ */
+ public void valueReadFromStore(boolean readFromStore) {
+ setFlag(readFromStore, READ_FROM_STORE_FLAG_MASK);
+ }
+
+ /**
+ * @return Flag indicating whether entry value was read from store.
+ */
+ public boolean valueReadFromStore() {
+ return isFlag(READ_FROM_STORE_FLAG_MASK);
+ }
+
+ /**
* Sets keep binary flag value.
*
* @param keepBinary Keep binary flag value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 8eea8dd..b7c1427 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1255,8 +1255,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
this,
/*swap*/true,
/*read-through*/false,
- /*fail fast*/true,
- /*unmarshal*/true,
/*metrics*/true,
/*event*/!skipVals,
/*temporary*/false,
@@ -1340,9 +1338,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
null,
this,
/*swap*/true,
- /*no read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
+ /*read-through*/false,
/*metrics*/true,
/*event*/true,
/*temporary*/false,
@@ -1687,8 +1683,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
IgniteTxLocalAdapter.this,
cacheCtx.isSwapOrOffheapEnabled(),
/*read-through*/false,
- /*fail-fast*/true,
- /*unmarshal*/true,
/*metrics*/true,
/*events*/!skipVals,
/*temporary*/false,
@@ -1992,7 +1986,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
needReadVer,
singleRmv,
hasFilters,
- skipStore,
+ (entryProcessor != null || cacheCtx.config().isLoadPreviousValue()) && !skipStore,
retval,
keepBinary);
}
@@ -2153,7 +2147,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
needReadVer,
singleRmv,
hasFilters,
- skipStore,
+ /*read through*/(invokeMap != null || cacheCtx.config().isLoadPreviousValue()) && !skipStore,
retval,
keepBinary);
}
@@ -2173,7 +2167,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
* @param needReadVer Read version flag.
* @param singleRmv {@code True} for single remove operation.
* @param hasFilters {@code True} if filters not empty.
- * @param skipStore Skip store flag.
+ * @param readThrough Read through flag.
* @param retval Return value flag.
* @return Load future.
*/
@@ -2185,7 +2179,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
final boolean needReadVer,
final boolean singleRmv,
final boolean hasFilters,
- final boolean skipStore,
+ final boolean readThrough,
final boolean retval,
final boolean keepBinary) {
GridInClosure3<KeyCacheObject, Object, GridCacheVersion> c =
@@ -2218,6 +2212,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
if (e.op() == TRANSFORM) {
GridCacheVersion ver;
+ e.readValue(cacheVal);
+
try {
ver = e.cached().version();
}
@@ -2243,7 +2239,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
return loadMissing(
cacheCtx,
- /*read through*/cacheCtx.config().isLoadPreviousValue() && !skipStore,
+ readThrough,
/*async*/true,
keys,
/*skipVals*/singleRmv,
@@ -2354,8 +2350,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
this,
/*swap*/false,
/*read-through*/false,
- /*fail-fast*/false,
- /*unmarshal*/retval,
/*metrics*/retval,
/*events*/retval,
/*temporary*/false,
@@ -2660,8 +2654,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
this,
/*swap*/true,
readThrough,
- /*failFast*/false,
- /*unmarshal*/true,
/*metrics*/!invoke,
/*event*/!invoke && !dht(),
/*temporary*/false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 09cf7c8..055bffd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -432,8 +432,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
@Nullable IgniteInternalTx tx,
boolean readSwap,
boolean readThrough,
- boolean failFast,
- boolean unmarshal,
boolean updateMetrics,
boolean evt,
boolean tmp,
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index ce60232..45b6e9d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -54,7 +54,7 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** */
- protected static final Map<Object, Object> storeMap = new ConcurrentHashMap8<>();
+ public static final Map<Object, Object> storeMap = new ConcurrentHashMap8<>();
/**
* @return Grids count to start.
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
new file mode 100644
index 0000000..17052f7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Collections;
+import java.util.Map;
+import javax.cache.configuration.Factory;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public abstract class IgniteCacheInvokeReadThroughAbstractTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static volatile boolean failed;
+
+ /** */
+ protected boolean client;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ cfg.setClientMode(client);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ failed = false;
+
+ startNodes();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ IgniteCacheAbstractTest.storeMap.clear();
+ }
+
+ /**
+ * @return Store factory.
+ */
+ protected Factory<CacheStore> cacheStoreFactory() {
+ return new IgniteCacheAbstractTest.TestStoreFactory();
+ }
+
+ /**
+ * @param data Data.
+ * @param cacheName Cache name.
+ * @throws Exception If failed.
+ */
+ protected void putDataInStore(Map<Object, Object> data, String cacheName) throws Exception {
+ IgniteCacheAbstractTest.storeMap.putAll(data);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ protected abstract void startNodes() throws Exception;
+
+ /**
+ * @param ccfg Cache configuration.
+ * @throws Exception If failed.
+ */
+ protected void invokeReadThrough(CacheConfiguration ccfg) throws Exception {
+ Ignite ignite0 = ignite(0);
+
+ ignite0.createCache(ccfg);
+
+ try {
+ int key = 0;
+
+ for (Ignite node : G.allGrids()) {
+ log.info("Test for node: " + node.name());
+
+ IgniteCache<Object, Object> cache = node.cache(ccfg.getName());
+
+ for (int i = 0; i < 50; i++)
+ checkReadThrough(cache, key++, null, null);
+
+ if (ccfg.getAtomicityMode() == TRANSACTIONAL) {
+ for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
+ for (TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (concurrency == TransactionConcurrency.OPTIMISTIC)
+ continue;
+
+ log.info("Test tx [concurrency=" + concurrency + ", isolation=" + isolation + ']');
+
+ for (int i = 0; i < 50; i++)
+ checkReadThrough(cache, key++, concurrency, isolation);
+ }
+ }
+ }
+ }
+
+ ignite0.cache(ccfg.getName()).removeAll();
+ }
+ finally {
+ ignite0.destroyCache(ccfg.getName());
+ }
+ }
+
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ * @param concurrency Transaction concurrency.
+ * @param isolation Transaction isolation.
+ * @throws Exception If failed.
+ */
+ private void checkReadThrough(IgniteCache<Object, Object> cache,
+ Object key,
+ TransactionConcurrency concurrency,
+ TransactionIsolation isolation) throws Exception {
+ putDataInStore(Collections.singletonMap(key, key), cache.getName());
+
+ Transaction tx = isolation != null ? cache.unwrap(Ignite.class).transactions().txStart(concurrency, isolation)
+ : null;
+
+ try {
+ Object ret = cache.invoke(key, new TestEntryProcessor());
+
+ assertEquals(key, ret);
+
+ if (tx != null)
+ tx.commit();
+ }
+ finally {
+ if (tx != null)
+ tx.close();
+ }
+
+ for (Ignite ignite : G.allGrids()) {
+ assertEquals("Unexpected value for node: " + ignite.name(),
+ (Integer)key + 1,
+ ignite.cache(cache.getName()).get(key));
+ }
+
+ assertFalse(failed);
+ }
+
+ /**
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Atomicity mode.
+ * @param backups Number of backups.
+ * @return Cache configuration.
+ */
+ @SuppressWarnings("unchecked")
+ protected CacheConfiguration cacheConfiguration(CacheMode cacheMode, CacheAtomicityMode atomicityMode, int backups) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setReadThrough(true);
+ ccfg.setWriteThrough(true);
+ ccfg.setCacheStoreFactory(cacheStoreFactory());
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+
+ if (cacheMode == PARTITIONED)
+ ccfg.setBackups(backups);
+
+ return ccfg;
+ }
+
+ /**
+ *
+ */
+ static class TestEntryProcessor implements EntryProcessor<Object, Object, Object> {
+ /** {@inheritDoc} */
+ @Override public Object process(MutableEntry<Object, Object> entry, Object... args) {
+ if (!entry.exists()) {
+ failed = true;
+
+ fail();
+ }
+
+ Integer val = (Integer)entry.getValue();
+
+ if (!val.equals(entry.getKey())) {
+ failed = true;
+
+ assertEquals(val, entry.getKey());
+ }
+
+ entry.setValue(val + 1);
+
+ return val;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
new file mode 100644
index 0000000..53c08a5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.LOCAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+
+/**
+ *
+ */
+public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvokeReadThroughAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected void startNodes() throws Exception {
+ startGrid(0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomic() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, ATOMIC, 1));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomicReplicated() throws Exception {
+ invokeReadThrough(cacheConfiguration(REPLICATED, ATOMIC, 0));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomicLocal() throws Exception {
+ invokeReadThrough(cacheConfiguration(LOCAL, ATOMIC, 0));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughTx() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL, 1));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughTxReplicated() throws Exception {
+ invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL, 0));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughTxLocal() throws Exception {
+ invokeReadThrough(cacheConfiguration(LOCAL, TRANSACTIONAL, 0));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
index 2464e81..89693f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
@@ -17,111 +17,77 @@
package org.apache.ignite.internal.processors.cache;
-import javax.cache.configuration.Factory;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.MutableEntry;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
/**
*
*/
-public class IgniteCacheInvokeReadThroughTest extends IgniteCacheAbstractTest {
+public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThroughAbstractTest {
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-114");
- }
+ @Override protected void startNodes() throws Exception {
+ startGridsMultiThreaded(4);
- /** */
- private static volatile boolean failed;
+ client = true;
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 3;
+ startGrid(4);
}
- /** {@inheritDoc} */
- @Override protected CacheMode cacheMode() {
- return PARTITIONED;
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomic0() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, ATOMIC, 0));
}
- /** {@inheritDoc} */
- @Override protected CacheAtomicityMode atomicityMode() {
- return TRANSACTIONAL;
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomic1() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, ATOMIC, 1));
}
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomic2() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, ATOMIC, 2));
}
- /** {@inheritDoc} */
- @Override protected Factory<CacheStore> cacheStoreFactory() {
- return new TestStoreFactory();
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughAtomicReplicated() throws Exception {
+ invokeReadThrough(cacheConfiguration(REPLICATED, ATOMIC, 0));
}
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
-
- failed = false;
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughTx0() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL, 0));
}
/**
* @throws Exception If failed.
*/
- public void testInvokeReadThrough() throws Exception {
- IgniteCache<Integer, Integer> cache = jcache(0);
-
- checkReadThrough(cache, primaryKey(cache));
-
- checkReadThrough(cache, backupKey(cache));
-
- checkReadThrough(cache, nearKey(cache));
+ public void testInvokeReadThroughTx1() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL, 1));
}
/**
- * @param cache Cache.
- * @param key Key.
+ * @throws Exception If failed.
*/
- private void checkReadThrough(IgniteCache<Integer, Integer> cache, Integer key) {
- log.info("Test [key=" + key + ']');
-
- storeMap.put(key, key);
-
- Object ret = cache.invoke(key, new EntryProcessor<Integer, Integer, Object>() {
- @Override public Object process(MutableEntry<Integer, Integer> entry, Object... args) {
- if (!entry.exists()) {
- failed = true;
-
- fail();
- }
-
- Integer val = entry.getValue();
-
- if (!val.equals(entry.getKey())) {
- failed = true;
-
- assertEquals(val, entry.getKey());
- }
-
- entry.setValue(val + 1);
-
- return val;
- }
- });
-
- assertEquals(key, ret);
-
- for (int i = 0; i < gridCount(); i++)
- assertEquals("Unexpected value for node: " + i, key + 1, jcache(i).get(key));
+ public void testInvokeReadThroughTx2() throws Exception {
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL, 2));
+ }
- assertFalse(failed);
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughTxReplicated() throws Exception {
+ invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL, 0));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
index 28a954b..dd6b268 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
@@ -147,6 +147,16 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
assertFalse(storeMap.containsKey(key));
assertNull(cache.get(key));
+
+ ldrCallCnt.set(0);
+
+ cache.invoke(key, new EntryProcessor<Object, Object, Object>() {
+ @Override public Object process(MutableEntry<Object, Object> e, Object... args) {
+ return null;
+ }
+ });
+
+ checkCalls(1, 0);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 5a017e6..9416af3 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -65,6 +65,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheConfigurationDefau
import org.apache.ignite.internal.processors.cache.IgniteCacheConfigurationTemplateTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheDynamicStopSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheGetCustomCollectionsSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheInvokeReadThroughSingleNodeTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheInvokeReadThroughTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheLoadRebalanceEvictionSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheTxCopyOnReadDisabledTest;
@@ -203,6 +204,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(IgniteCacheTxLocalPeekModesTest.class);
suite.addTestSuite(IgniteCacheTxReplicatedPeekModesTest.class);
+ suite.addTestSuite(IgniteCacheInvokeReadThroughSingleNodeTest.class);
suite.addTestSuite(IgniteCacheInvokeReadThroughTest.class);
suite.addTestSuite(GridCacheVersionMultinodeTest.class);