You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/10/22 12:31:17 UTC
[5/5] ignite git commit: IGNITE-950 - WIP fixing tests.
IGNITE-950 - WIP fixing tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54e0b63a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54e0b63a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54e0b63a
Branch: refs/heads/ignite-950-new
Commit: 54e0b63a3b3d4c05b9fcb7e1ddbac2f548c70e1b
Parents: f812afd
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Oct 22 13:30:42 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Oct 22 13:30:42 2015 +0300
----------------------------------------------------------------------
.../ignite/codegen/MessageCodeGenerator.java | 5 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 58 ++++++++++++--------
.../distributed/near/GridNearGetFuture.java | 7 +--
.../near/GridNearTransactionalCache.java | 4 +-
.../local/atomic/GridLocalAtomicCache.java | 36 ++++++++----
.../cache/query/GridCacheQueryManager.java | 13 +++--
.../transactions/IgniteTxLocalAdapter.java | 5 +-
7 files changed, 81 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index 8d9a3f5..b8ccc03 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectMap;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.IgniteCodeGeneratingFail;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
@@ -165,7 +166,9 @@ public class MessageCodeGenerator {
MessageCodeGenerator gen = new MessageCodeGenerator(srcDir);
- gen.generateAll(true);
+// gen.generateAll(true);
+
+ gen.generateAndWrite(GridNearAtomicUpdateRequest.class);
// gen.generateAndWrite(DataStreamerEntry.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index bbf3e3a..d3b6afc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -684,66 +684,72 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
writer.incrementState();
case 14:
- if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+ if (!writer.writeBoolean("keepBinary", keepBinary))
return false;
writer.incrementState();
case 15:
- if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+ if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
return false;
writer.incrementState();
case 16:
- if (!writer.writeBoolean("retval", retval))
+ if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
return false;
writer.incrementState();
case 17:
- if (!writer.writeBoolean("skipStore", skipStore))
+ if (!writer.writeBoolean("retval", retval))
return false;
writer.incrementState();
case 18:
- if (!writer.writeUuid("subjId", subjId))
+ if (!writer.writeBoolean("skipStore", skipStore))
return false;
writer.incrementState();
case 19:
- if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+ if (!writer.writeUuid("subjId", subjId))
return false;
writer.incrementState();
case 20:
- if (!writer.writeInt("taskNameHash", taskNameHash))
+ if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
return false;
writer.incrementState();
case 21:
- if (!writer.writeBoolean("topLocked", topLocked))
+ if (!writer.writeInt("taskNameHash", taskNameHash))
return false;
writer.incrementState();
case 22:
- if (!writer.writeMessage("topVer", topVer))
+ if (!writer.writeBoolean("topLocked", topLocked))
return false;
writer.incrementState();
case 23:
- if (!writer.writeMessage("updateVer", updateVer))
+ if (!writer.writeMessage("topVer", topVer))
return false;
writer.incrementState();
case 24:
+ if (!writer.writeMessage("updateVer", updateVer))
+ return false;
+
+ writer.incrementState();
+
+ case 25:
if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
return false;
@@ -854,7 +860,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
case 14:
- keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+ keepBinary = reader.readBoolean("keepBinary");
if (!reader.isLastRead())
return false;
@@ -862,6 +868,14 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
case 15:
+ keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 16:
byte opOrd;
opOrd = reader.readByte("op");
@@ -873,7 +887,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 16:
+ case 17:
retval = reader.readBoolean("retval");
if (!reader.isLastRead())
@@ -881,7 +895,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 17:
+ case 18:
skipStore = reader.readBoolean("skipStore");
if (!reader.isLastRead())
@@ -889,7 +903,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 18:
+ case 19:
subjId = reader.readUuid("subjId");
if (!reader.isLastRead())
@@ -897,7 +911,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 19:
+ case 20:
byte syncModeOrd;
syncModeOrd = reader.readByte("syncMode");
@@ -909,7 +923,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 20:
+ case 21:
taskNameHash = reader.readInt("taskNameHash");
if (!reader.isLastRead())
@@ -917,7 +931,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 21:
+ case 22:
topLocked = reader.readBoolean("topLocked");
if (!reader.isLastRead())
@@ -925,7 +939,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 22:
+ case 23:
topVer = reader.readMessage("topVer");
if (!reader.isLastRead())
@@ -933,7 +947,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 23:
+ case 24:
updateVer = reader.readMessage("updateVer");
if (!reader.isLastRead())
@@ -941,7 +955,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
reader.incrementState();
- case 24:
+ case 25:
vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
if (!reader.isLastRead())
@@ -961,7 +975,7 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 25;
+ return 26;
}
/** {@inheritDoc} */
@@ -969,4 +983,4 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
"parent", super.toString());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/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 d9763f8..3da08c7 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
@@ -534,11 +534,8 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
}
if (v != null && !reload) {
- K key0 = key.value(cctx.cacheObjectContext(), true);
- V val0 = v.value(cctx.cacheObjectContext(), true);
-
- val0 = (V)cctx.unwrapPortableIfNeeded(val0, !deserializePortable);
- key0 = (K)cctx.unwrapPortableIfNeeded(key0, !deserializePortable);
+ K key0 = (K)cctx.unwrapPortableIfNeeded(key, !deserializePortable);
+ V val0 = (V)cctx.unwrapPortableIfNeeded(v, !deserializePortable);
add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0)));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
diff --git 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
index 99c2b87..03486d6 100644
--- 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
@@ -138,8 +138,6 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
final boolean skipStore = opCtx != null && opCtx.skipStore();
- final boolean keepBinary = opCtx != null && opCtx.isKeepPortable();
-
if (tx != null && !tx.implicit() && !skipTx) {
return asyncOp(tx, new AsyncOp<Map<K, V>>(keys) {
@Override public IgniteInternalFuture<Map<K, V>> op(IgniteTxLocalAdapter tx) {
@@ -148,7 +146,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
entry,
deserializePortable,
skipVals,
- keepBinary,
+ false,
skipStore);
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/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 bf0bb00..39f9f61 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
@@ -144,6 +144,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
@Override public V getAndPut(K key, V val, @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
A.notNull(key, "key", val, "val");
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
return (V)updateAllInternal(UPDATE,
Collections.singleton(key),
Collections.singleton(val),
@@ -154,7 +156,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
filter,
ctx.writeThrough(),
ctx.readThrough(),
- ctx.operationContextPerCall().isKeepPortable());
+ opCtx != null && opCtx.isKeepPortable());
}
/** {@inheritDoc} */
@@ -328,6 +330,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
long start = statsEnabled ? System.nanoTime() : 0L;
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
updateAllInternal(UPDATE,
m.keySet(),
m.values(),
@@ -338,7 +342,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
CU.empty0(),
ctx.writeThrough(),
ctx.readThrough(),
- ctx.operationContextPerCall().isKeepPortable());
+ opCtx != null && opCtx.isKeepPortable());
if (statsEnabled)
metrics0().addPutTimeNanos(System.nanoTime() - start);
@@ -357,6 +361,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public V getAndRemove(K key) throws IgniteCheckedException {
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
return (V)updateAllInternal(DELETE,
Collections.singleton(key),
null,
@@ -367,7 +373,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
CU.empty0(),
ctx.writeThrough(),
ctx.readThrough(),
- ctx.operationContextPerCall().isKeepPortable());
+ opCtx != null && opCtx.isKeepPortable());
}
/** {@inheritDoc} */
@@ -379,6 +385,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void removeAll(Collection<? extends K> keys) throws IgniteCheckedException {
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
updateAllInternal(DELETE,
keys,
null,
@@ -389,7 +397,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
CU.empty0(),
ctx.writeThrough(),
ctx.readThrough(),
- ctx.operationContextPerCall().isKeepPortable());
+ opCtx != null && opCtx.isKeepPortable());
}
/** {@inheritDoc} */
@@ -438,6 +446,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
@Override public boolean remove(K key, V val) throws IgniteCheckedException {
A.notNull(key, "key", val, "val");
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
return (Boolean)updateAllInternal(DELETE,
Collections.singleton(key),
null,
@@ -448,7 +458,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
ctx.equalsValArray(val),
ctx.writeThrough(),
ctx.readThrough(),
- ctx.operationContextPerCall().isKeepPortable());
+ opCtx != null && opCtx.isKeepPortable());
}
/** {@inheritDoc} */
@@ -663,7 +673,9 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
}
});
- final boolean keepPortable = ctx.operationContextPerCall().isKeepPortable();
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+ final boolean keepPortable = opCtx != null && opCtx.isKeepPortable();
return (Map<K, EntryProcessorResult<T>>)updateAllInternal(TRANSFORM,
invokeMap.keySet(),
@@ -749,7 +761,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
if (keyCheck)
validateCacheKeys(map.keySet());
- final boolean keepPortable = ctx.operationContextPerCall().isKeepPortable();
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
return (Map<K, EntryProcessorResult<T>>)updateAllInternal(TRANSFORM,
map.keySet(),
@@ -761,7 +773,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
null,
ctx.writeThrough(),
ctx.readThrough(),
- keepPortable);
+ opCtx != null && opCtx.isKeepPortable());
}
/** {@inheritDoc} */
@@ -812,9 +824,11 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
final boolean readThrough = ctx.readThrough();
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
final ExpiryPolicy expiry = expiryPerCall();
- final boolean keepPortable = ctx.operationContextPerCall().isKeepPortable();
+ final boolean keepPortable = opCtx != null && opCtx.isKeepPortable();
IgniteInternalFuture fut = asyncOp(new Callable<Object>() {
@Override public Object call() throws Exception {
@@ -863,7 +877,9 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
final ExpiryPolicy expiryPlc = expiryPerCall();
- final boolean keepPortable = ctx.operationContextPerCall().isKeepPortable();
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+ final boolean keepPortable = opCtx != null && opCtx.isKeepPortable();
IgniteInternalFuture fut = asyncOp(new Callable<Object>() {
@Override public Object call() throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 1c8107e..58a8424 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -907,7 +907,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
CacheObject cacheVal =
entry != null ? entry.peek(true, false, false, topVer, expiryPlc) : null;
- val = cacheVal != null ? (V)cacheVal.value(cctx.cacheObjectContext(), false) : null;
+ // TODO 950 nocopy
+ val = (V)cctx.cacheObjectContext().unwrapPortableIfNeeded(cacheVal, qry.keepPortable());
}
catch (GridCacheEntryRemovedException e) {
val = null;
@@ -1093,7 +1094,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
next = null;
while (it.hasNext()) {
- final LazySwapEntry e = new LazySwapEntry(it.next());
+ final LazySwapEntry e = new LazySwapEntry(it.next(), keepPortable);
if (filter != null) {
K key = (K)cctx.unwrapPortableIfNeeded(e.key(), keepPortable);
@@ -2510,11 +2511,15 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
/** */
private final Map.Entry<byte[], byte[]> e;
+ /** */
+ private boolean keepBinary;
+
/**
* @param e Entry with
*/
- LazySwapEntry(Map.Entry<byte[], byte[]> e) {
+ LazySwapEntry(Map.Entry<byte[], byte[]> e, boolean keepBinary) {
this.e = e;
+ this.keepBinary = keepBinary;
}
/** {@inheritDoc} */
@@ -2529,7 +2534,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
CacheObject obj = cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(), t.get2(), t.get1());
- return obj.value(cctx.cacheObjectContext(), false);
+ return (V)cctx.cacheObjectContext().unwrapPortableIfNeeded(obj, keepBinary);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/54e0b63a/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 c5def9a..930ed83 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
@@ -1781,8 +1781,9 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
// Load keys only after the locks have been acquired.
for (KeyCacheObject cacheKey : lockKeys) {
- K keyVal =
- (K)(keepCacheObjects ? cacheKey : cacheKey.value(cacheCtx.cacheObjectContext(), false));
+ K keyVal = (K)
+ (keepCacheObjects ? cacheKey :
+ cacheCtx.cacheObjectContext().unwrapPortableIfNeeded(cacheKey, !deserializePortable));
if (retMap.containsKey(keyVal))
// We already have a return value.