# ignite-42
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/25d4d8de Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/25d4d8de Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/25d4d8de Branch: refs/heads/ignite-32 Commit: 25d4d8de5a29d2eb2a1333bd1f689578199cc2a5 Parents: f4da39a Author: sboikov <sboi...@gridgain.com> Authored: Wed Jan 21 15:03:25 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Wed Jan 21 18:52:54 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheAdapter.java | 4 +- .../processors/cache/GridCacheStoreManager.java | 12 + .../distributed/dht/GridDhtCacheAdapter.java | 8 +- .../cache/distributed/dht/GridDhtGetFuture.java | 7 + .../dht/GridDhtTransactionalCacheAdapter.java | 2 +- .../dht/GridPartitionedGetFuture.java | 7 + .../dht/atomic/GridDhtAtomicCache.java | 1 + .../dht/colocated/GridDhtColocatedCache.java | 3 + .../distributed/near/GridNearCacheAdapter.java | 1 + .../distributed/near/GridNearGetFuture.java | 7 + .../distributed/near/GridNearGetRequest.java | 89 +++-- .../near/GridNearTransactionalCache.java | 2 + .../cache/distributed/near/GridNearTxLocal.java | 9 +- .../local/atomic/GridLocalAtomicCache.java | 2 +- .../transactions/IgniteTxLocalAdapter.java | 12 +- .../cache/transactions/IgniteTxLocalEx.java | 1 + ...CacheAtomicLocalNoLoadPreviousValueTest.java | 49 +++ ...gniteCacheAtomicLocalNoWriteThroughTest.java | 49 +++ ...tomicNearEnabledNoLoadPreviousValueTest.java | 32 ++ ...acheAtomicNearEnabledNoWriteThroughTest.java | 32 ++ ...gniteCacheAtomicNoLoadPreviousValueTest.java | 55 +++ .../IgniteCacheAtomicNoWriteThroughTest.java | 55 +++ ...iteCacheNoLoadPreviousValueAbstractTest.java | 213 ++++++++++++ .../IgniteCacheNoReadThroughAbstractTest.java | 34 +- .../IgniteCacheNoWriteThroughAbstractTest.java | 345 +++++++++++++++++++ ...niteCacheTxLocalNoLoadPreviousValueTest.java | 49 +++ .../IgniteCacheTxLocalNoWriteThroughTest.java | 49 +++ ...cheTxNearEnabledNoLoadPreviousValueTest.java | 32 ++ ...iteCacheTxNearEnabledNoWriteThroughTest.java | 32 ++ .../IgniteCacheTxNoLoadPreviousValueTest.java | 49 +++ .../IgniteCacheTxNoWriteThroughTest.java | 49 +++ ...idCacheConfigurationConsistencySelfTest.java | 6 +- .../near/GridCacheNearMultiNodeSelfTest.java | 1 + .../bamboo/GridDataGridTestSuite.java | 14 + .../GridSpringDynamicCacheManagerSelfTest.java | 3 +- 35 files changed, 1267 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java index f02b4c8..e383af2 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java @@ -1771,6 +1771,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im subjId = ctx.subjectIdPerCall(subjId, prj); return getAllAsync(keys, + true, entry, !skipTx, subjId, @@ -1783,6 +1784,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im /** {@inheritDoc} */ public IgniteFuture<Map<K, V>> getAllAsync(@Nullable final Collection<? extends K> keys, + boolean readThrough, @Nullable GridCacheEntryEx<K, V> cached, boolean checkTx, @Nullable final UUID subjId, @@ -1902,7 +1904,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im } } - if (misses != null && ctx.readThrough()) { + if (misses != null && readThrough && ctx.readThrough()) { final Map<K, GridCacheVersion> loadKeys = misses; final Collection<K> redos = new LinkedList<>(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java index 7d92f83..dddede9 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java @@ -62,6 +62,9 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { private final boolean locStore; /** */ + private final boolean writeThrough; + + /** */ private boolean convertPortable; /** @@ -85,6 +88,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { ThreadLocal<SessionData> sesHolder0 = null; + writeThrough = cfg.isWriteThrough(); + if (cfgStore != null) { try { if (!sesHolders.containsKey(cfgStore)) { @@ -114,6 +119,13 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { } /** + * @return {@code True} is write-through is enabled. + */ + public boolean writeThrough() { + return writeThrough; + } + + /** * @return Unwrapped store provided in configuration. */ public CacheStore<?, ?> configuredStore() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index f9a0f82..8360413 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -477,7 +477,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap /** * This method is used internally. Use - * {@link #getDhtAsync(UUID, long, LinkedHashMap, boolean, long, UUID, int, boolean, IgnitePredicate[], org.gridgain.grid.kernal.processors.cache.IgniteCacheExpiryPolicy)} + * {@link #getDhtAsync(UUID, long, LinkedHashMap, boolean, boolean, long, UUID, int, boolean, IgnitePredicate[], IgniteCacheExpiryPolicy)} * method instead to retrieve DHT value. * * @param keys {@inheritDoc} @@ -497,6 +497,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter ) { return getAllAsync(keys, + true, null, /*don't check local tx. */false, subjId, @@ -528,6 +529,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap * @return Get future. */ IgniteFuture<Map<K, V>> getDhtAllAsync(@Nullable Collection<? extends K> keys, + boolean readThrough, @Nullable UUID subjId, String taskName, boolean deserializePortable, @@ -535,6 +537,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap @Nullable IgniteCacheExpiryPolicy expiry ) { return getAllAsync(keys, + readThrough, null, /*don't check local tx. */false, subjId, @@ -561,6 +564,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap public GridDhtFuture<Collection<GridCacheEntryInfo<K, V>>> getDhtAsync(UUID reader, long msgId, LinkedHashMap<? extends K, Boolean> keys, + boolean readThrough, boolean reload, long topVer, @Nullable UUID subjId, @@ -572,6 +576,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap msgId, reader, keys, + readThrough, reload, /*tx*/null, topVer, @@ -601,6 +606,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap getDhtAsync(nodeId, req.messageId(), req.keys(), + req.readThrough(), req.reload(), req.topologyVersion(), req.subjectId(), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtGetFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtGetFuture.java index c65ecdd..8edd980 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtGetFuture.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtGetFuture.java @@ -53,6 +53,9 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col /** Reload flag. */ private boolean reload; + /** Read through flag. */ + private boolean readThrough; + /** Context. */ private GridCacheContext<K, V> cctx; @@ -121,6 +124,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col long msgId, UUID reader, LinkedHashMap<? extends K, Boolean> keys, + boolean readThrough, boolean reload, @Nullable IgniteTxLocalEx<K, V> tx, long topVer, @@ -138,6 +142,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col this.cctx = cctx; this.msgId = msgId; this.keys = keys; + this.readThrough = readThrough; this.reload = reload; this.filters = filters; this.tx = tx; @@ -353,6 +358,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col else { if (tx == null) { fut = cache().getDhtAllAsync(keys.keySet(), + readThrough, subjId, taskName, deserializePortable, @@ -389,6 +395,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col else { if (tx == null) { return cache().getDhtAllAsync(keys.keySet(), + readThrough, subjId, taskName, deserializePortable, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java index dfa8ad8..e911750 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java @@ -999,7 +999,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach if (ret) val = e.innerGet(tx, /*swap*/true, - /*read-through*/true, + /*read-through*/ctx.loadPreviousValue(), /*fail-fast.*/false, /*unmarshal*/false, /*update-metrics*/true, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridPartitionedGetFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridPartitionedGetFuture.java index a5ddaf7..ee71d23 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridPartitionedGetFuture.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridPartitionedGetFuture.java @@ -66,6 +66,9 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M /** Reload flag. */ private boolean reload; + /** Read-through flag. */ + private boolean readThrough; + /** Force primary flag. */ private boolean forcePrimary; @@ -123,6 +126,7 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M GridCacheContext<K, V> cctx, Collection<? extends K> keys, long topVer, + boolean readThrough, boolean reload, boolean forcePrimary, @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filters, @@ -138,6 +142,7 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M this.cctx = cctx; this.keys = keys; this.topVer = topVer; + this.readThrough = readThrough; this.reload = reload; this.forcePrimary = forcePrimary; this.filters = filters; @@ -313,6 +318,7 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M cache().getDhtAsync(n.id(), -1, mappedKeys, + readThrough, reload, topVer, subjId, @@ -366,6 +372,7 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M fut.futureId(), ver, mappedKeys, + readThrough, reload, topVer, filters, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index 186f2a0..6b1f624 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -963,6 +963,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { GridPartitionedGetFuture<K, V> fut = new GridPartitionedGetFuture<>(ctx, keys, topVer, + true, reload, forcePrimary, filter, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index 62c12f9..7a7b0b5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -185,6 +185,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte return loadAsync(keys, false, + true, forcePrimary, topVer, subjId, @@ -236,6 +237,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte * @return Loaded values. */ public IgniteFuture<Map<K, V>> loadAsync(@Nullable Collection<? extends K> keys, + boolean readThrough, boolean reload, boolean forcePrimary, long topVer, @@ -345,6 +347,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte GridPartitionedGetFuture<K, V> fut = new GridPartitionedGetFuture<>(ctx, keys, topVer, + readThrough, reload, forcePrimary, filter, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearCacheAdapter.java index 6617dc6..1c017a6 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearCacheAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearCacheAdapter.java @@ -291,6 +291,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda GridNearGetFuture<K, V> fut = new GridNearGetFuture<>(ctx, keys, + true, reload, forcePrimary, txx, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetFuture.java index 7184c7b..0eb350e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetFuture.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetFuture.java @@ -66,6 +66,9 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma /** Reload flag. */ private boolean reload; + /** Read through flag. */ + private boolean readThrough; + /** Force primary flag. */ private boolean forcePrimary; @@ -125,6 +128,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma public GridNearGetFuture( GridCacheContext<K, V> cctx, Collection<? extends K> keys, + boolean readThrough, boolean reload, boolean forcePrimary, @Nullable IgniteTxLocalEx<K, V> tx, @@ -140,6 +144,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma this.cctx = cctx; this.keys = keys; + this.readThrough = readThrough; this.reload = reload; this.forcePrimary = forcePrimary; this.filters = filters; @@ -313,6 +318,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma dht().getDhtAsync(n.id(), -1, mappedKeys, + readThrough, reload, topVer, subjId, @@ -372,6 +378,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma fut.futureId(), ver, mappedKeys, + readThrough, reload, topVer, filters, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java index ff1c705..36e3646 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java @@ -56,6 +56,9 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements /** Reload flag. */ private boolean reload; + /** Read through flag. */ + private boolean readThrough; + /** */ @GridToStringExclude @GridDirectMap(keyType = byte[].class, valueType = boolean.class) @@ -95,6 +98,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements * @param miniId Sub ID. * @param ver Version. * @param keys Keys. + * @param readThrough Read through flag. * @param reload Reload flag. * @param topVer Topology version. * @param filter Filter. @@ -108,6 +112,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements IgniteUuid miniId, GridCacheVersion ver, LinkedHashMap<K, Boolean> keys, + boolean readThrough, boolean reload, long topVer, IgnitePredicate<GridCacheEntry<K, V>>[] filter, @@ -125,6 +130,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements this.miniId = miniId; this.ver = ver; this.keys = keys; + this.readThrough = readThrough; this.reload = reload; this.topVer = topVer; this.filter = filter; @@ -183,6 +189,13 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements } /** + * @return Read through flag. + */ + public boolean readThrough() { + return readThrough; + } + + /** * @return Topology version. */ @Override public long topologyVersion() { @@ -256,12 +269,14 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements _clone.ver = ver; _clone.keys = keys; _clone.reload = reload; + _clone.readThrough = readThrough; _clone.keyBytes = keyBytes; _clone.filterBytes = filterBytes; _clone.topVer = topVer; _clone.filter = filter; _clone.subjId = subjId; _clone.taskNameHash = taskNameHash; + _clone.accessTtl = accessTtl; } /** {@inheritDoc} */ @@ -281,6 +296,12 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements switch (commState.idx) { case 3: + if (!commState.putLong(accessTtl)) + return false; + + commState.idx++; + + case 4: if (filterBytes != null) { if (commState.it == null) { if (!commState.putInt(filterBytes.length)) @@ -307,13 +328,13 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 4: + case 5: if (!commState.putGridUuid(futId)) return false; commState.idx++; - case 5: + case 6: if (keyBytes != null) { if (commState.it == null) { if (!commState.putInt(keyBytes.size())) @@ -351,44 +372,44 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 6: - if (!commState.putGridUuid(miniId)) - return false; - - commState.idx++; - case 7: - if (!commState.putBoolean(reload)) + if (!commState.putGridUuid(miniId)) return false; commState.idx++; case 8: - if (!commState.putLong(topVer)) + if (!commState.putBoolean(readThrough)) return false; commState.idx++; case 9: - if (!commState.putCacheVersion(ver)) + if (!commState.putBoolean(reload)) return false; commState.idx++; case 10: - if (!commState.putUuid(subjId)) + if (!commState.putLong(topVer)) return false; commState.idx++; case 11: - if (!commState.putInt(taskNameHash)) + if (!commState.putCacheVersion(ver)) return false; commState.idx++; case 12: - if (!commState.putLong(accessTtl)) + if (!commState.putUuid(subjId)) + return false; + + commState.idx++; + + case 13: + if (!commState.putInt(taskNameHash)) return false; commState.idx++; @@ -408,6 +429,14 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements switch (commState.idx) { case 3: + if (buf.remaining() < 8) + return false; + + accessTtl = commState.getLong(); + + commState.idx++; + + case 4: if (commState.readSize == -1) { if (buf.remaining() < 4) return false; @@ -436,7 +465,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 4: + case 5: IgniteUuid futId0 = commState.getGridUuid(); if (futId0 == GRID_UUID_NOT_READ) @@ -446,7 +475,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 5: + case 6: if (commState.readSize == -1) { if (buf.remaining() < 4) return false; @@ -488,7 +517,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 6: + case 7: IgniteUuid miniId0 = commState.getGridUuid(); if (miniId0 == GRID_UUID_NOT_READ) @@ -498,7 +527,15 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 7: + case 8: + if (buf.remaining() < 1) + return false; + + readThrough = commState.getBoolean(); + + commState.idx++; + + case 9: if (buf.remaining() < 1) return false; @@ -506,7 +543,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 8: + case 10: if (buf.remaining() < 8) return false; @@ -514,7 +551,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 9: + case 11: GridCacheVersion ver0 = commState.getCacheVersion(); if (ver0 == CACHE_VER_NOT_READ) @@ -524,7 +561,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 10: + case 12: UUID subjId0 = commState.getUuid(); if (subjId0 == UUID_NOT_READ) @@ -534,7 +571,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 11: + case 13: if (buf.remaining() < 4) return false; @@ -542,14 +579,6 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements commState.idx++; - case 12: - if (buf.remaining() < 8) - return false; - - accessTtl = commState.getLong(); - - commState.idx++; - } return true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTransactionalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTransactionalCache.java index d80c1ab..992070f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -143,6 +143,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V> */ IgniteFuture<Map<K, V>> txLoadAsync(GridNearTxLocal<K, V> tx, @Nullable Collection<? extends K> keys, + boolean readThrough, @Nullable IgnitePredicate<GridCacheEntry<K, V>>[] filter, boolean deserializePortable, @Nullable IgniteCacheExpiryPolicy expiryPlc) { @@ -150,6 +151,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V> GridNearGetFuture<K, V> fut = new GridNearGetFuture<>(ctx, keys, + readThrough, false, false, tx, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java index 442293b..b2b9f0b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java @@ -98,8 +98,8 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { * @param concurrency Concurrency. * @param isolation Isolation. * @param timeout Timeout. - * @param invalidate - * @param storeEnabled + * @param invalidate Invalidate flag. + * @param storeEnabled Store enabled flag. * @param txSize Transaction size. * @param grpLockKey Group lock key if this is a group lock transaction. * @param partLock {@code True} if this is a group-lock transaction and the whole partition should be locked. @@ -279,6 +279,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { /** {@inheritDoc} */ @Override public IgniteFuture<Boolean> loadMissing( GridCacheContext<K, V> cacheCtx, + boolean readThrough, boolean async, final Collection<? extends K> keys, boolean deserializePortable, @@ -287,6 +288,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { if (cacheCtx.isNear()) { return cacheCtx.nearTx().txLoadAsync(this, keys, + readThrough, CU.<K, V>empty(), deserializePortable, accessPolicy(cacheCtx, keys)).chain(new C1<IgniteFuture<Map<K, V>>, Boolean>() { @@ -311,6 +313,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { } else if (cacheCtx.isColocated()) { return cacheCtx.colocated().loadAsync(keys, + readThrough, /*reload*/false, /*force primary*/false, topologyVersion(), @@ -341,7 +344,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { else { assert cacheCtx.isLocal(); - return super.loadMissing(cacheCtx, async, keys, deserializePortable, c); + return super.loadMissing(cacheCtx, readThrough, async, keys, deserializePortable, c); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java index c4080d0..3fc4dd7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java @@ -639,7 +639,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> { return map; } - return getAllAsync(keys, null, false, subjId, taskName, deserializePortable, false, expiry, filter).get(); + return getAllAsync(keys, true, null, false, subjId, taskName, deserializePortable, false, expiry, filter).get(); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java index 06ee6b0..a063535 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -305,6 +305,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> /** {@inheritDoc} */ @Override public IgniteFuture<Boolean> loadMissing( final GridCacheContext<K, V> cacheCtx, + final boolean readThrough, boolean async, final Collection<? extends K> keys, boolean deserializePortable, @@ -312,7 +313,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> ) { if (!async) { try { - if (!cacheCtx.readThrough()) { + if (!readThrough || !cacheCtx.readThrough()) { for (K key : keys) c.apply(key, null); @@ -330,7 +331,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> return cctx.kernalContext().closure().callLocalSafe( new GPC<Boolean>() { @Override public Boolean call() throws Exception { - if (!cacheCtx.readThrough()) { + if (!readThrough || !cacheCtx.readThrough()) { for (K key : keys) c.apply(key, null); @@ -465,7 +466,8 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> protected void batchStoreCommit(Iterable<IgniteTxEntry<K, V>> writeEntries) throws IgniteCheckedException { GridCacheStoreManager<K, V> store = store(); - if (store != null && storeEnabled() && (!internal() || groupLock()) && (near() || store.writeToStoreFromDht())) { + if (store != null && store.writeThrough() && storeEnabled() && + (!internal() || groupLock()) && (near() || store.writeToStoreFromDht())) { try { if (writeEntries != null) { Map<K, IgniteBiTuple<V, GridCacheVersion>> putMap = null; @@ -1333,7 +1335,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> return new GridEmbeddedFuture<>(cctx.kernalContext(), loadMissing( cacheCtx, - false, missedMap.keySet(), deserializePortable, new CI2<K, V>() { + true, false, missedMap.keySet(), deserializePortable, new CI2<K, V>() { /** */ private GridCacheVersion nextVer; @@ -2053,6 +2055,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> IgniteFuture<Boolean> fut = loadMissing( cacheCtx, + op == TRANSFORM || cacheCtx.loadPreviousValue(), true, F.asList(key), deserializePortables(cacheCtx), @@ -2193,6 +2196,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> IgniteFuture<Boolean> fut = loadMissing( cacheCtx, true, + true, missedForInvoke, deserializePortables(cacheCtx), new CI2<K, V>() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java index e631586..afa5c11 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java @@ -171,6 +171,7 @@ public interface IgniteTxLocalEx<K, V> extends IgniteTxEx<K, V> { */ public IgniteFuture<Boolean> loadMissing( GridCacheContext<K, V> cacheCtx, + boolean readThrough, boolean async, Collection<? extends K> keys, boolean deserializePortable, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoLoadPreviousValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoLoadPreviousValueTest.java new file mode 100644 index 0000000..194f474 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoLoadPreviousValueTest.java @@ -0,0 +1,49 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheAtomicLocalNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 1; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return LOCAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return ATOMIC; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoWriteThroughTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoWriteThroughTest.java new file mode 100644 index 0000000..b6f0312 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLocalNoWriteThroughTest.java @@ -0,0 +1,49 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheAtomicLocalNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 1; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return LOCAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return ATOMIC; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.java new file mode 100644 index 0000000..6d2879f --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.java @@ -0,0 +1,32 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; + +/** + * + */ +public class IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest extends IgniteCacheAtomicNoLoadPreviousValueTest { + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return NEAR_PARTITIONED; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoWriteThroughTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoWriteThroughTest.java new file mode 100644 index 0000000..d4eb3dd --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNearEnabledNoWriteThroughTest.java @@ -0,0 +1,32 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; + +/** + * + */ +public class IgniteCacheAtomicNearEnabledNoWriteThroughTest extends IgniteCacheAtomicNoWriteThroughTest { + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return NEAR_PARTITIONED; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java new file mode 100644 index 0000000..bb11d01 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java @@ -0,0 +1,55 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicWriteOrderMode.*; +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheAtomicNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 3; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return ATOMIC; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() { + return PRIMARY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java new file mode 100644 index 0000000..4bfd623 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java @@ -0,0 +1,55 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicWriteOrderMode.*; +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheAtomicNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 3; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return ATOMIC; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() { + return PRIMARY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoLoadPreviousValueAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoLoadPreviousValueAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoLoadPreviousValueAbstractTest.java new file mode 100644 index 0000000..5386f33 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoLoadPreviousValueAbstractTest.java @@ -0,0 +1,213 @@ +/* + * 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.integration; + +import org.apache.ignite.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.cache.store.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.transactions.*; +import org.gridgain.grid.cache.*; + +import javax.cache.processor.*; +import java.util.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * Test for configuration property {@link CacheConfiguration#isLoadPreviousValue()}. + */ +public abstract class IgniteCacheNoLoadPreviousValueAbstractTest extends IgniteCacheAbstractTest { + /** */ + private Integer lastKey = 0; + + /** {@inheritDoc} */ + @Override protected CacheStore<?, ?> cacheStore() { + return new TestStore(); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.getTransactionsConfiguration().setTxSerializableEnabled(true); + + return cfg; + } + + /** {@inheritDoc} */ + @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { + CacheConfiguration ccfg = super.cacheConfiguration(gridName); + + ccfg.setReadThrough(true); + + ccfg.setWriteThrough(true); + + ccfg.setLoadPreviousValue(false); + + return ccfg; + } + + /** + * @throws Exception If failed. + */ + public void testNoLoadPreviousValue() throws Exception { + IgniteCache<Integer, Integer> cache = jcache(0); + + for (Integer key : keys()) { + log.info("Test [key=" + key + ']'); + + storeMap.put(key, key); + + assertEquals(key, cache.get(key)); + + assertEquals(key, storeMap.get(key)); + + cache.remove(key); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + assertNull(cache.getAndPut(key, -1)); + + assertEquals(-1, storeMap.get(key)); + + cache.remove(key); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + assertTrue(cache.putIfAbsent(key, -1)); + + assertEquals(-1, storeMap.get(key)); + + cache.remove(key); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + assertNull(cache.getAndRemove(key)); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + assertNull(cache.getAndPutIfAbsent(key, -1)); + + assertEquals(-1, storeMap.get(key)); + + cache.remove(key); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + assertFalse(cache.replace(key, -1)); + + assertEquals(key, storeMap.get(key)); + + assertNull(cache.getAndReplace(key, -1)); + + assertEquals(key, storeMap.get(key)); + + assertFalse(cache.replace(key, key, -1)); + + assertEquals(key, storeMap.get(key)); + } + + Map<Integer, Integer> expData = new HashMap<>(); + + for (int i = 1000_0000; i < 1000_0000 + 1000; i++) { + storeMap.put(i, i); + + expData.put(i, i); + } + + assertEquals(expData, cache.getAll(expData.keySet())); + + if (atomicityMode() == TRANSACTIONAL) { + for (IgniteTxConcurrency concurrency : IgniteTxConcurrency.values()) { + for (IgniteTxIsolation isolation : IgniteTxIsolation.values()) { + for (Integer key : keys()) { + log.info("Test tx [key=" + key + + ", concurrency=" + concurrency + + ", isolation=" + isolation + ']'); + + storeMap.put(key, key); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + assertNull(cache.getAndPut(key, -1)); + + tx.commit(); + } + + assertEquals(-1, storeMap.get(key)); + + cache.remove(key); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + assertTrue(cache.putIfAbsent(key, -1)); + + tx.commit(); + } + + assertEquals(-1, storeMap.get(key)); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + assertEquals(expData, cache.getAll(expData.keySet())); + + tx.commit(); + } + } + } + } + } + } + + /** + * @return Test keys. + * @throws Exception If failed. + */ + protected Collection<Integer> keys() throws Exception { + GridCache<Integer, Object> cache = cache(0); + + ArrayList<Integer> keys = new ArrayList<>(); + + keys.add(primaryKeys(cache, 1, lastKey).get(0)); + + if (gridCount() > 1) { + keys.add(backupKeys(cache, 1, lastKey).get(0)); + + if (cache.configuration().getCacheMode() != REPLICATED) + keys.add(nearKeys(cache, 1, lastKey).get(0)); + } + + lastKey = Collections.max(keys) + 1; + + return keys; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoReadThroughAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoReadThroughAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoReadThroughAbstractTest.java index 7087934..fa0b148 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoReadThroughAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoReadThroughAbstractTest.java @@ -35,7 +35,7 @@ import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; import static org.gridgain.grid.cache.GridCacheMode.*; /** - * + * Test for configuration property {@link CacheConfiguration#isReadThrough}. */ public abstract class IgniteCacheNoReadThroughAbstractTest extends IgniteCacheAbstractTest { /** */ @@ -87,6 +87,8 @@ public abstract class IgniteCacheNoReadThroughAbstractTest extends IgniteCacheAb ccfg.setWriteThrough(true); + ccfg.setLoadPreviousValue(true); + return ccfg; } @@ -228,6 +230,34 @@ public abstract class IgniteCacheNoReadThroughAbstractTest extends IgniteCacheAb assertEquals(-1, storeMap.get(key)); + cache.remove(key); + + assertNull(storeMap.get(key)); + + storeMap.put(key, key); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + Object ret = cache.invoke(key, new EntryProcessor<Integer, Integer, Object>() { + @Override public Object process(MutableEntry<Integer, Integer> e, Object... args) { + Integer val = e.getValue(); + + assertFalse(e.exists()); + + assertNull(val); + + e.setValue(-1); + + return String.valueOf(val); + } + }); + + assertEquals("null", ret); + + tx.commit(); + } + + assertEquals(-1, storeMap.get(key)); + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { assertTrue(cache.getAll(keys).isEmpty()); @@ -238,7 +268,7 @@ public abstract class IgniteCacheNoReadThroughAbstractTest extends IgniteCacheAb } } - // Check + // Check can load cache when read-through is disabled. allowLoad = true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java new file mode 100644 index 0000000..4c0f151 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java @@ -0,0 +1,345 @@ +/* + * 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.integration; + +import org.apache.ignite.*; +import org.apache.ignite.cache.CacheConfiguration; +import org.apache.ignite.cache.store.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.transactions.*; +import org.gridgain.grid.cache.*; + +import javax.cache.processor.*; +import java.util.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * Test for configuration property {@link CacheConfiguration#isWriteThrough}. + */ +public abstract class IgniteCacheNoWriteThroughAbstractTest extends IgniteCacheAbstractTest { + /** */ + private Integer lastKey = 0; + + /** {@inheritDoc} */ + @Override protected CacheStore<?, ?> cacheStore() { + return new TestStore(); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.getTransactionsConfiguration().setTxSerializableEnabled(true); + + return cfg; + } + + /** {@inheritDoc} */ + @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { + CacheConfiguration ccfg = super.cacheConfiguration(gridName); + + ccfg.setReadThrough(true); + + ccfg.setWriteThrough(false); + + ccfg.setLoadPreviousValue(true); + + return ccfg; + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings("UnnecessaryLocalVariable") + public void testNoWriteThrough() throws Exception { + IgniteCache<Integer, Integer> cache = jcache(0); + + for (Integer key : keys()) { + log.info("Test [key=" + key + ']'); + + final Integer storeVal = key; + + storeMap.put(key, storeVal ); + + assertEquals(key, cache.get(key)); + + cache.remove(key); + + assertEquals(storeVal, storeMap.get(key)); + + storeMap.remove(key); + + assertNull(cache.get(key)); + + assertTrue(cache.putIfAbsent(key, key)); + + assertNull(storeMap.get(key)); + + assertEquals(key, cache.get(key)); + + cache.remove(key); + + storeMap.put(key, storeVal); + + Integer val = key + 1; + + assertFalse(cache.putIfAbsent(key, val)); + + assertEquals(storeVal, storeMap.get(key)); + + cache.put(key, val); + + assertEquals(val, cache.get(key)); + + assertEquals(storeVal, storeMap.get(key)); + + val = val + 1; + + assertTrue(cache.replace(key, val)); + + assertEquals(val, cache.get(key)); + + assertEquals(storeVal, storeMap.get(key)); + + cache.remove(key); + + assertEquals(storeVal, storeMap.get(key)); + + storeMap.remove(key); + + assertNull(cache.get(key)); + + storeMap.put(key, storeVal); + + val = val + 1; + + assertEquals(storeVal, cache.getAndPut(key, val)); + + assertEquals(storeVal, storeMap.get(key)); + + assertEquals(val, cache.get(key)); + + cache.remove(key); + + assertEquals(storeVal, storeMap.get(key)); + + assertEquals(storeVal, cache.getAndRemove(key)); + + cache.remove(key); + + assertEquals(storeVal, storeMap.get(key)); + + Object ret = cache.invoke(key, new EntryProcessor<Integer, Integer, Object>() { + @Override public Object process(MutableEntry<Integer, Integer> entry, Object... args) { + Integer val = entry.getValue(); + + entry.setValue(val + 1); + + return String.valueOf(val); + } + }); + + assertEquals(String.valueOf(storeVal), ret); + + assertEquals(storeVal + 1, (int)cache.get(key)); + + assertEquals(storeVal, storeMap.get(key)); + + assertTrue(cache.replace(key, storeVal + 1, storeVal + 2)); + + assertEquals(storeVal, storeMap.get(key)); + + assertEquals(storeVal + 2, (int) cache.get(key)); + } + + Map<Integer, Integer> expData = new HashMap<>(); + + for (int i = 1000_0000; i < 1000_0000 + 1000; i++) { + storeMap.put(i, i); + + expData.put(i, i); + } + + assertEquals(expData, cache.getAll(expData.keySet())); + + storeMap.clear(); + + cache.putAll(expData); + + assertTrue(storeMap.isEmpty()); + + assertEquals(expData, cache.getAll(expData.keySet())); + + Map<Integer, Integer> expData0 = new HashMap<>(); + + for (int i = 1000_0000; i < 1000_0000 + 1000; i++) + expData0.put(i, 1); + + cache.invokeAll(expData.keySet(), new EntryProcessor<Integer, Integer, Object>() { + @Override public Object process(MutableEntry<Integer, Integer> entry, Object... args) { + entry.setValue(1); + + return null; + } + }); + + assertEquals(expData0, cache.getAll(expData0.keySet())); + + assertTrue(storeMap.isEmpty()); + + storeMap.putAll(expData); + + cache.removeAll(expData.keySet()); + + assertEquals(1000, storeMap.size()); + + storeMap.clear(); + + assertTrue(cache.getAll(expData.keySet()).isEmpty()); + + if (atomicityMode() == TRANSACTIONAL) { + for (IgniteTxConcurrency concurrency : IgniteTxConcurrency.values()) { + for (IgniteTxIsolation isolation : IgniteTxIsolation.values()) { + for (Integer key : keys()) { + log.info("Test tx [key=" + key + + ", concurrency=" + concurrency + + ", isolation=" + isolation + ']'); + + storeMap.put(key, key); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + assertEquals(key, cache.getAndPut(key, -1)); + + tx.commit(); + } + + assertEquals(-1, (int)cache.get(key)); + + assertEquals(key, storeMap.get(key)); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + cache.put(key, -2); + + tx.commit(); + } + + assertEquals(-2, (int)cache.get(key)); + + assertEquals(key, storeMap.get(key)); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + assertEquals(-2, (int)cache.getAndRemove(key)); + + tx.commit(); + } + + assertEquals(key, storeMap.get(key)); + + storeMap.remove(key); + + assertNull(cache.get(key)); + + storeMap.put(key, key); + + cache.put(key, key); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + assertTrue(cache.replace(key, -1)); + + tx.commit(); + } + + assertEquals(-1, (int)cache.get(key)); + + assertEquals(key, storeMap.get(key)); + + cache.remove(key); + + storeMap.clear(); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + cache.putAll(expData); + + tx.commit(); + } + + assertTrue(storeMap.isEmpty()); + + assertEquals(expData, cache.getAll(expData.keySet())); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + cache.invokeAll(expData.keySet(), new EntryProcessor<Integer, Integer, Object>() { + @Override public Object process(MutableEntry<Integer, Integer> entry, Object... args) { + entry.setValue(1); + + return null; + } + }); + + tx.commit(); + } + + assertEquals(expData0, cache.getAll(expData.keySet())); + + assertTrue(storeMap.isEmpty()); + + storeMap.putAll(expData); + + try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + cache.removeAll(expData.keySet()); + + tx.commit(); + } + + assertEquals(1000, storeMap.size()); + + storeMap.clear(); + + assertTrue(cache.getAll(expData.keySet()).isEmpty()); + } + } + } + } + } + + /** + * @return Test keys. + * @throws Exception If failed. + */ + protected Collection<Integer> keys() throws Exception { + GridCache<Integer, Object> cache = cache(0); + + ArrayList<Integer> keys = new ArrayList<>(); + + keys.add(primaryKeys(cache, 1, lastKey).get(0)); + + if (gridCount() > 1) { + keys.add(backupKeys(cache, 1, lastKey).get(0)); + + if (cache.configuration().getCacheMode() != REPLICATED) + keys.add(nearKeys(cache, 1, lastKey).get(0)); + } + + lastKey = Collections.max(keys) + 1; + + return keys; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java new file mode 100644 index 0000000..c3b45e3 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java @@ -0,0 +1,49 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheTxLocalNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 1; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return LOCAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java new file mode 100644 index 0000000..b426b75 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java @@ -0,0 +1,49 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheTxLocalNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 1; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return LOCAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java new file mode 100644 index 0000000..b2019c5 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java @@ -0,0 +1,32 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; + +/** + * + */ +public class IgniteCacheTxNearEnabledNoLoadPreviousValueTest extends IgniteCacheTxNoLoadPreviousValueTest { + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return NEAR_PARTITIONED; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java new file mode 100644 index 0000000..7ee2ef0 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java @@ -0,0 +1,32 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; + +/** + * + */ +public class IgniteCacheTxNearEnabledNoWriteThroughTest extends IgniteCacheTxNoWriteThroughTest { + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return NEAR_PARTITIONED; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25d4d8de/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java new file mode 100644 index 0000000..7c6ee23 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java @@ -0,0 +1,49 @@ +/* + * 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.integration; + +import org.gridgain.grid.cache.*; + +import static org.gridgain.grid.cache.GridCacheAtomicityMode.*; +import static org.gridgain.grid.cache.GridCacheDistributionMode.*; +import static org.gridgain.grid.cache.GridCacheMode.*; + +/** + * + */ +public class IgniteCacheTxNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest { + /** {@inheritDoc} */ + @Override protected int gridCount() { + return 3; + } + + /** {@inheritDoc} */ + @Override protected GridCacheMode cacheMode() { + return PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected GridCacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } + + /** {@inheritDoc} */ + @Override protected GridCacheDistributionMode distributionMode() { + return PARTITIONED_ONLY; + } +}