# ignite-51
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ea5bd46a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ea5bd46a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ea5bd46a Branch: refs/heads/ignite-51 Commit: ea5bd46aebbe67357b2a20f58027d53a8323c17e Parents: a040311 29508fa Author: sboikov <sboi...@gridgain.com> Authored: Mon Mar 2 16:07:13 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Mar 2 16:25:32 2015 +0300 ---------------------------------------------------------------------- .../distributed/near/GridNearAtomicCache.java | 5 +- .../distributed/near/GridNearCacheAdapter.java | 5 +- .../distributed/near/GridNearCacheEntry.java | 46 +++-- .../distributed/near/GridNearGetFuture.java | 27 +-- .../near/GridNearTransactionalCache.java | 7 +- .../communication/GridCacheMessageSelfTest.java | 172 +++++++++++++++++++ 6 files changed, 205 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea5bd46a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java index 4ebcced,a30f372..2358013 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java @@@ -367,12 -369,12 +367,15 @@@ public class GridNearAtomicCache<K, V> if (F.isEmpty(keys)) return new GridFinishedFuture<>(ctx.kernalContext(), Collections.<K, V>emptyMap()); ++ if (keyCheck) ++ validateCacheKeys(keys); ++ GridCacheProjectionImpl<K, V> prj = ctx.projectionPerCall(); subjId = ctx.subjectIdPerCall(subjId, prj); return loadAsync(null, -- keys, ++ ctx.cacheKeysView(keys), false, forcePrimary, subjId, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea5bd46a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java index b8f8c6f,a32b6a8..e34019b --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java @@@ -275,7 -275,7 +275,7 @@@ public abstract class GridNearCacheAdap * @return Loaded values. */ public IgniteInternalFuture<Map<K, V>> loadAsync(@Nullable IgniteInternalTx tx, -- @Nullable Collection<? extends K> keys, ++ @Nullable Collection<KeyCacheObject> keys, boolean reload, boolean forcePrimary, @Nullable UUID subjId, @@@ -287,9 -287,9 +287,6 @@@ if (F.isEmpty(keys)) return new GridFinishedFuture<>(ctx.kernalContext(), Collections.<K, V>emptyMap()); -- if (keyCheck) -- validateCacheKeys(keys); -- IgniteTxLocalEx txx = (tx != null && tx.local()) ? (IgniteTxLocalEx)tx : null; final IgniteCacheExpiryPolicy expiry = expiryPolicy(expiryPlc); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea5bd46a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java index 2d859a0,2f6bebb..911f77b --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java @@@ -273,22 -280,22 +273,18 @@@ public class GridNearCacheEntry extend if (dhtVer == null) return null; else { -- CacheObject val0 = null; -- byte[] valBytes0 = null; - - // TODO IGNITE-51. - // GridCacheValueBytes valBytesTuple = valueBytes(); - // - // if (!valBytesTuple.isNull()) { - // if (valBytesTuple.isPlain()) - // val0 = (V)valBytesTuple.get(); - // else - // valBytes0 = valBytesTuple.get(); - // } - // else - // val0 = val; - - return F.t(dhtVer, val0, valBytes0); ++ CacheObject val0 = val; + -// TODO IGNITE-51. -// GridCacheValueBytes valBytesTuple = valueBytes(); -// -// if (!valBytesTuple.isNull()) { -// if (valBytesTuple.isPlain()) -// val0 = (V)valBytesTuple.get(); -// else -// valBytes0 = valBytesTuple.get(); -// } -// else -// val0 = val; - - return F.t(dhtVer, val0, valBytes0); ++ if (val0 == null && valPtr != 0) { ++ IgniteBiTuple<byte[], Boolean> t = valueBytes0(); ++ ++ if (t.get2()) ++ val0 = cctx.toCacheObject(t.get1(), null); ++ else ++ val0 = cctx.toCacheObject(null, t.get1()); ++ } ++ ++ return F.t(ver, val0, null); } } @@@ -320,17 -327,17 +316,15 @@@ /** {@inheritDoc} */ @Override protected Object readThrough(IgniteInternalTx tx, KeyCacheObject key, boolean reload, UUID subjId, String taskName) throws IgniteCheckedException { -- return null; --// TODO IGNTIE-51. --// return cctx.near().loadAsync(tx, --// F.asList(key), --// reload, --// /*force primary*/false, --// subjId, --// taskName, --// true, --// null, --// false).get().get(key); ++ return cctx.near().loadAsync(tx, ++ F.asList(key), ++ reload, ++ /*force primary*/false, ++ subjId, ++ taskName, ++ true, ++ null, ++ false).get().get(key.value(cctx, false)); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea5bd46a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java index ef76366,ef76366..31481f2 --- 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 @@@ -63,7 -63,7 +63,7 @@@ public final class GridNearGetFuture<K private GridCacheContext<K, V> cctx; /** Keys. */ -- private Collection<? extends K> keys; ++ private Collection<KeyCacheObject> keys; /** Reload flag. */ private boolean reload; @@@ -130,7 -130,7 +130,7 @@@ */ public GridNearGetFuture( GridCacheContext<K, V> cctx, -- Collection<? extends K> keys, ++ Collection<KeyCacheObject> keys, boolean readThrough, boolean reload, boolean forcePrimary, @@@ -170,21 -170,21 +170,7 @@@ public void init() { long topVer = tx == null ? cctx.affinity().affinityTopologyVersion() : tx.topologyVersion(); -- Collection<KeyCacheObject> keys0 = F.viewReadOnly(keys, new C1<K, KeyCacheObject>() { -- @Override public KeyCacheObject apply(K key) { -- if (key == null) { -- NullPointerException err = new NullPointerException("Null key."); -- -- onDone(err); -- -- throw err; -- } -- -- return cctx.toCacheKeyObject(key); -- } -- }); -- -- map(keys0, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer); ++ map(keys, Collections.<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>>emptyMap(), topVer); markInitialized(); } @@@ -199,13 -199,13 +185,6 @@@ // Should not flip trackable flag from true to false since get future can be remapped. } -- /** -- * @return Keys. -- */ -- Collection<? extends K> keys() { -- return keys; -- } -- /** {@inheritDoc} */ @Override public IgniteUuid futureId() { return futId; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea5bd46a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index e35e0fd,6e88c4f..7c1243e --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@@ -111,6 -111,6 +111,9 @@@ public class GridNearTransactionalCache if (F.isEmpty(keys)) return new GridFinishedFuture<>(ctx.kernalContext(), Collections.<K, V>emptyMap()); ++ if (keyCheck) ++ validateCacheKeys(keys); ++ IgniteTxLocalAdapter tx = ctx.tm().threadLocalTx(); if (tx != null && !tx.implicit() && !skipTx) { @@@ -131,7 -126,7 +134,7 @@@ subjId = ctx.subjectIdPerCall(subjId, prj); return loadAsync(null, -- keys, ++ ctx.cacheKeysView(keys), false, forcePrimary, subjId, @@@ -150,7 -145,7 +153,7 @@@ * @return Future. */ IgniteInternalFuture<Map<K, V>> txLoadAsync(GridNearTxLocal tx, -- @Nullable Collection<? extends K> keys, ++ @Nullable Collection<KeyCacheObject> keys, boolean readThrough, boolean deserializePortable, @Nullable IgniteCacheExpiryPolicy expiryPlc,