ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # ignite-51
Date Tue, 03 Mar 2015 07:37:50 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-51 0687b0382 -> 9fdb40c94


# 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/9fdb40c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9fdb40c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9fdb40c9

Branch: refs/heads/ignite-51
Commit: 9fdb40c947313437f9bed36dbcc3903fe36fcc79
Parents: 0687b03
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Mar 3 09:23:09 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Mar 3 10:37:42 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/CacheObjectAdapter.java   | 12 +++++++++++-
 .../internal/processors/cache/GridCacheMapEntry.java    | 10 ++++++----
 .../internal/processors/cache/GridCacheProcessor.java   |  5 ++---
 .../datastructures/CacheDataStructuresManager.java      |  7 ++++---
 .../processors/cache/query/GridCacheQueryManager.java   |  3 +--
 .../processors/cache/transactions/IgniteTxAdapter.java  |  2 +-
 .../datastructures/DataStructuresProcessor.java         |  7 +++----
 ...GridCacheAtomicInvalidPartitionHandlingSelfTest.java |  4 ++--
 .../cache/GridCacheOffHeapAndSwapSelfTest.java          |  2 +-
 .../processors/cache/GridCacheSwapSelfTest.java         |  2 +-
 .../apache/ignite/spring/GridSpringCacheTestKey.java    |  4 +++-
 11 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
index 5cf3521..89a2ac1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
@@ -52,14 +52,24 @@ public abstract class CacheObjectAdapter implements CacheObject, Externalizable
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
+        byte[] valBytes = byteArray() ? (byte[])val : this.valBytes;
+
         assert valBytes != null;
 
+        out.writeBoolean(byteArray());
         U.writeByteArray(out, valBytes);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        valBytes = U.readByteArray(in);
+        boolean byteArr = in.readBoolean();
+
+        byte[] valBytes = U.readByteArray(in);
+
+        if (byteArr)
+            val = valBytes;
+        else
+            this.valBytes = valBytes;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 83742c4..b93b76f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -188,7 +188,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         // In case we deal with IGFS cache, count updated data
         if (cctx.cache().isIgfsDataCache() && cctx.kernalContext().igfsHelper().isIgfsBlockKey(key.value(cctx,
false))) {
             int newSize = valueLength0(val, null);
-            int oldSize = valueLength0(this.val, this.val == null ? valueBytes0() : null);
+            int oldSize = valueLength0(this.val, (this.val == null && valPtr != 0)
? valueBytes0() : null);
 
             int delta = newSize - oldSize;
 
@@ -3708,8 +3708,9 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
         try {
             GridCacheQueryManager qryMgr = cctx.queries();
 
+            // TODO IGNITE-51.
             if (qryMgr != null)
-                qryMgr.store(key, null, val, null, ver, expireTime);
+                qryMgr.store(key.value(cctx, false), null, CU.value(val, cctx, false), null,
ver, expireTime);
         }
         catch (IgniteCheckedException e) {
             throw new GridCacheIndexUpdateException(e);
@@ -3728,8 +3729,9 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
         try {
             GridCacheQueryManager<?, ?> qryMgr = cctx.queries();
 
+            // TODO IGNITE-51.
             if (qryMgr != null)
-                qryMgr.remove(key());
+                qryMgr.remove(key().value(cctx, false));
         }
         catch (IgniteCheckedException e) {
             throw new GridCacheIndexUpdateException(e);
@@ -4393,7 +4395,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx
{
                     GridTuple<CacheObject> peek = tx.peek(cctx, false, key, null);
 
                     if (peek != null)
-                        return peek.get().value(cctx, false);
+                        return CU.value(peek.get(), cctx, false);
                 }
 
                 if (detached())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 9770245..48cab9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1507,10 +1507,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
             if (qryMgr != null) {
                 try {
-                    // TODO IGNITE-51.
-                    KeyCacheObject key = cctx.marshaller().unmarshal(keyBytes, cctx.shared().deploy().globalLoader());
+                    KeyCacheObject key = cctx.toCacheKeyObject(null, keyBytes);
 
-                    qryMgr.remove(key);
+                    qryMgr.remove(key.value(cctx, false));
                 }
                 catch (IgniteCheckedException e) {
                     U.error(log, "Failed to unmarshal key evicted from swap [swapSpaceName="
+ spaceName + ']', e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
index 04308b7..ba4d44c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
@@ -247,9 +247,10 @@ public class CacheDataStructuresManager<K, V> extends GridCacheManagerAdapter<K,
      * @param rmv {@code True} if entry was removed.
      */
     public void onEntryUpdated(KeyCacheObject key, boolean rmv) {
-        // TODO IGNITE-51.
-        if (key instanceof GridCacheSetItemKey)
-            onSetItemUpdated((GridCacheSetItemKey)key, rmv);
+        Object key0 = key.value(cctx, false);
+
+        if (key0 instanceof GridCacheSetItemKey)
+            onSetItemUpdated((GridCacheSetItemKey)key0, rmv);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/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 c539b73..d1f6d0f 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
@@ -345,11 +345,10 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
     /**
      * @param key Key.
-     * @param keyBytes Byte array with key value.
      * @throws IgniteCheckedException Thrown in case of any errors.
      */
     @SuppressWarnings("SimplifiableIfStatement")
-    public void remove(KeyCacheObject key) throws IgniteCheckedException {
+    public void remove(Object key) throws IgniteCheckedException {
         assert key != null;
 
         if (!cctx.config().isQueryIndexEnabled() && !(key instanceof GridCacheInternal))

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 563d38c..1cd4521 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -901,7 +901,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
      * @return {@code True} if key is internal.
      */
     protected boolean checkInternal(IgniteTxKey key) {
-        if (key.key() instanceof GridCacheInternal) {
+        if (key.key().internal()) {
             internal = true;
 
             return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 55cf140..91c69ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -1005,9 +1005,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
{
             for (IgniteTxEntry entry : entries) {
                 // Check updated or created GridCacheInternalKey keys.
                 if ((entry.op() == CREATE || entry.op() == UPDATE) && entry.key().internal())
{
-                    GridCacheInternal key = (GridCacheInternal)entry.key();
+                    GridCacheInternal key = entry.key().value(entry.context(), false);
 
-                    // TODO IGNITE-51.
                     Object val0 = CU.value(entry.value(), entry.context(), false);
 
                     if (val0 instanceof GridCacheCountDownLatchValue) {
@@ -1038,8 +1037,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
{
                 }
 
                 // Check deleted GridCacheInternal keys.
-                if (entry.op() == DELETE && entry.key() instanceof GridCacheInternal)
{
-                    GridCacheInternal key = (GridCacheInternal)entry.key();
+                if (entry.op() == DELETE && entry.key().internal()) {
+                    GridCacheInternal key = entry.key().value(entry.context(), false);
 
                     // Entry's val is null if entry deleted.
                     GridCacheRemovable obj = dsMap.remove(key);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 590e5e4..651ba8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -258,7 +258,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
                                 if (val == null) {
                                     assertNull(ver);
 
-                                    val = entry.rawGetOrUnmarshal(false);
+                                    val = CU.value(entry.rawGetOrUnmarshal(false), entry.context(),
false);
                                     ver = entry.version();
                                     nodeId = locNode.id();
                                 }
@@ -267,7 +267,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
 
                                     assertEquals("Failed to check value for key [key=" +
k + ", node=" +
                                         locNode.id() + ", primary=" + primary + ", recNodeId="
+ nodeId + ']',
-                                        val, entry.rawGetOrUnmarshal(false));
+                                        val, CU.value(entry.rawGetOrUnmarshal(false), entry.context(),
false));
                                     assertEquals(ver, entry.version());
                                 }
                             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
index 544d445..28f7ce0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
@@ -274,7 +274,7 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest
{
             Long val = entry.rawGet().value(entry.context(), false);
 
             assertNotNull("Value null for key: " + i, val);
-            assertEquals(entry.key(), val);
+            assertEquals(entry.key().value(entry.context(), false), val);
             assertEquals(entry.version(), versions.get(i));
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
index 34240e1..f6e875e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
@@ -644,7 +644,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest {
             CacheValue val = CU.value(entry.rawGet(), entry.context(), false);
 
             assert val != null;
-            assert CU.value(entry.key(), entry.context(), false) == val.value();
+            assertEquals(CU.value(entry.key(), entry.context(), false), val.value());
             assert entry.version().equals(versions.get(i));
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fdb40c9/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
index 70c9de0..a195562 100644
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
+++ b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
@@ -17,10 +17,12 @@
 
 package org.apache.ignite.spring;
 
+import java.io.*;
+
 /**
  * Complex key.
  */
-public class GridSpringCacheTestKey {
+public class GridSpringCacheTestKey implements Serializable {
     /** */
     private final Integer p1;
 


Mime
View raw message