ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/20] incubator-ignite git commit: # ignite-51
Date Mon, 09 Mar 2015 16:51:03 GMT
# 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/84979b40
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/84979b40
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/84979b40

Branch: refs/heads/ignite-51-v2
Commit: 84979b40a5b7a3fd5d56d2bfa6b4ee94f9c06b82
Parents: f86bbe8
Author: sboikov <semen.boikov@inria.fr>
Authored: Sat Mar 7 00:15:06 2015 +0300
Committer: sboikov <semen.boikov@inria.fr>
Committed: Sun Mar 8 13:48:13 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 38 +++++---------------
 .../processors/cache/GridCacheContext.java      | 28 ---------------
 .../processors/cache/GridCacheStoreManager.java | 21 ++---------
 .../processors/cache/GridCacheSwapManager.java  |  3 --
 .../IgniteCacheOsSerializationManager.java      |  5 ---
 .../preloader/GridDhtPartitionSupplyPool.java   |  2 --
 .../distributed/near/GridNearGetFuture.java     |  6 ++--
 .../IgniteCacheSerializationManager.java        |  6 ----
 .../portable/GridPortableProcessor.java         | 29 +++------------
 .../IgniteCacheObjectProcessorAdapter.java      | 17 ++++-----
 .../portable/os/GridOsPortableProcessor.java    | 14 --------
 11 files changed, 27 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 9c05499..6acf2e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4050,18 +4050,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
         ExpiryPolicy plc = prj != null ? prj.expiry() : null;
 
-        final Collection<? extends K> keys0;
-
-        if (ctx.portableEnabled() && !ctx.store().convertPortable()) {
-            keys0 = F.viewReadOnly(keys, new C1<K, K>() {
-                @Override public K apply(K k) {
-                    return (K)ctx.marshalToPortable(k);
-                }
-            });
-        }
-        else
-            keys0 = keys;
-
         if (replaceExisting) {
             if (ctx.store().isLocalStore()) {
                 Collection<ClusterNode> nodes = ctx.grid().cluster().forDataNodes(name()).nodes();
@@ -4070,14 +4058,14 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
                     return new GridFinishedFuture<>(ctx.kernalContext());
 
                 return ctx.closures().callAsyncNoFailover(BROADCAST,
-                    new LoadKeysCallable<>(ctx.name(), keys0, true, plc),
+                    new LoadKeysCallable<>(ctx.name(), keys, true, plc),
                     nodes,
                     true);
             }
             else {
                 return ctx.closures().callLocalSafe(new Callable<Void>() {
                     @Override public Void call() throws Exception {
-                        localLoadAndUpdate(keys0);
+                        localLoadAndUpdate(keys);
 
                         return null;
                     }
@@ -4102,26 +4090,21 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
      * @throws IgniteCheckedException If failed.
      */
     private void localLoadAndUpdate(final Collection<? extends K> keys) throws IgniteCheckedException
{
-        try (final IgniteDataLoader<KeyCacheObject, CacheObject> ldr =
+        try (final IgniteDataLoaderImpl<KeyCacheObject, CacheObject> ldr =
                  ctx.kernalContext().<KeyCacheObject, CacheObject>dataLoad().dataLoader(ctx.namex()))
{
             ldr.allowOverwrite(true);
             ldr.skipStore(true);
 
-            final Collection<Map.Entry<KeyCacheObject, CacheObject>> col = new
ArrayList<>(ldr.perNodeBufferSize());
+            final Collection<IgniteDataLoaderEntry> col = new ArrayList<>(ldr.perNodeBufferSize());
 
-            // TODO IGNITE-51.
-            Collection<KeyCacheObject> keys0 = F.viewReadOnly(keys, new C1<K, KeyCacheObject>()
{
-                @Override public KeyCacheObject apply(K key) {
-                    return ctx.toCacheKeyObject(key);
-                }
-            });
+            Collection<KeyCacheObject> keys0 = ctx.cacheKeysView(keys);
 
             ctx.store().loadAllFromStore(null, keys0, new CIX2<KeyCacheObject, Object>()
{
                 @Override public void applyx(KeyCacheObject key, Object val) {
-                    col.add(new GridMapEntry<>(key, ctx.toCacheObject(val)));
+                    col.add(new IgniteDataLoaderEntry(key, ctx.toCacheObject(val)));
 
                     if (col.size() == ldr.perNodeBufferSize()) {
-                        ldr.addData(col);
+                        ldr.addDataInternal(col);
 
                         col.clear();
                     }
@@ -4147,12 +4130,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
         final ExpiryPolicy plc0 = plc != null ? plc : ctx.expiry();
 
-        // TODO IGNITE-51.
-        Collection<KeyCacheObject> keys0 = F.viewReadOnly(keys, new C1<K, KeyCacheObject>()
{
-            @Override public KeyCacheObject apply(K key) {
-                return ctx.toCacheKeyObject(key);
-            }
-        });
+        Collection<KeyCacheObject> keys0 = ctx.cacheKeysView(keys);
 
         if (ctx.store().isLocalStore()) {
             IgniteDataLoaderImpl ldr = ctx.kernalContext().<K, V>dataLoad().dataLoader(ctx.namex());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 3ef5dcb..21cfd55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1703,13 +1703,6 @@ public class GridCacheContext<K, V> implements Externalizable
{
     }
 
     /**
-     * @return Keep portable in store flag.
-     */
-    public boolean keepPortableInStore() {
-        return serMgr.keepPortableInStore();
-    }
-
-    /**
      * @return Keep portable flag.
      */
     public boolean keepPortable() {
@@ -1739,27 +1732,6 @@ public class GridCacheContext<K, V> implements Externalizable
{
     }
 
     /**
-     * @param obj Object.
-     * @return Portable object.
-     * @throws IgniteException In case of error.
-     */
-    @Nullable public Object marshalToPortable(@Nullable Object obj) throws IgniteException
{
-        assert portableEnabled();
-
-        if (obj == null)
-            return null;
-
-        if (ctx.portable().isPortableObject(obj) || obj instanceof GridCacheInternal)
-            return obj;
-
-        GridPortableProcessor proc = kernalContext().portable();
-
-        assert proc != null;
-
-        return proc.marshalToPortable(obj);
-    }
-
-    /**
      * Unwraps collection.
      *
      * @param col Collection to unwrap.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
index 1c872a0..4bc5658 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
@@ -180,13 +180,7 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
             }
         }
 
-        boolean convertPortable = !cctx.keepPortableInStore();
-
-        if (cctx.portableEnabled())
-            this.convertPortable = convertPortable;
-        else if (convertPortable)
-            U.warn(log, "CacheConfiguration.isKeepPortableInStore() configuration property
will " +
-                "be ignored because portable mode is not enabled for cache: " + cctx.namex());
+        convertPortable = !cctx.portable().keepPortableInStore(cctx.name());
     }
 
     /** {@inheritDoc} */
@@ -301,7 +295,7 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
             if (convert) {
                 val = convert(val);
 
-                return cctx.portableEnabled() ? cctx.marshalToPortable(val) : val;
+                return val;
             }
             else
                 return val;
@@ -435,12 +429,6 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter {
                         if (convert) {
                             Object v = convert(val);
 
-// TODO IGNITE-51
-//                            if (cctx.portableEnabled()) {
-//                                k = (K)cctx.marshalToPortable(k);
-//                                v = (V)cctx.marshalToPortable(v);
-//                            }
-
                             vis.apply(cctx.toCacheKeyObject(k), v);
                         }
                         else {
@@ -1166,10 +1154,7 @@ public class GridCacheStoreManager extends GridCacheManagerAdapter
{
          * @return {@code True} if original map contains entry.
          */
         private boolean mapContains(Cache.Entry<?, ?> e) {
-            Object key = convertPortable ? cctx.marshalToPortable(e.getKey()) : e.getKey();
-
-            return map.containsKey(key);
-
+            return map.containsKey(e.getKey());
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 7f65e0e..d52c6ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1704,9 +1704,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      * @return Undeploy count.
      */
     public int onUndeploy(ClassLoader ldr) {
-        if (cctx.portableEnabled())
-            return 0;
-
         IgniteUuid ldrId = cctx.deploy().getClassLoaderId(ldr);
 
         assert ldrId != null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOsSerializationManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOsSerializationManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOsSerializationManager.java
index 594f791..80d87a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOsSerializationManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOsSerializationManager.java
@@ -32,11 +32,6 @@ public class IgniteCacheOsSerializationManager<K, V> extends GridCacheManagerAda
     }
 
     /** {@inheritDoc} */
-    @Override public boolean keepPortableInStore() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
     @Override public Object unwrapPortableIfNeeded(Object o, boolean keepPortable) {
         return o;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
index 96c2cb1..24f7c94 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
@@ -247,8 +247,6 @@ class GridDhtPartitionSupplyPool<K, V> {
 
             boolean ack = false;
 
-            boolean convertPortable = cctx.portableEnabled() && cctx.offheapTiered();
-
             try {
                 // Partition map exchange is finished which means that all near transactions
with given
                 // topology version are committed. We can wait for local locks here as it
will not take

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/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 b26c1ac..e1d35ed 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
@@ -493,10 +493,8 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
                     K key0 = key.value(cctx.cacheObjectContext(), false);
                     V val0 = v.value(cctx.cacheObjectContext(), true);
 
-                    if (cctx.portableEnabled()) {
-                        val0 = (V)cctx.unwrapPortableIfNeeded(val0, !deserializePortable);
-                        key0 = (K)cctx.unwrapPortableIfNeeded(key0, !deserializePortable);
-                    }
+                    val0 = (V)cctx.unwrapPortableIfNeeded(val0, !deserializePortable);
+                    key0 = (K)cctx.unwrapPortableIfNeeded(key0, !deserializePortable);
 
                     add(new GridFinishedFuture<>(cctx.kernalContext(), Collections.singletonMap(key0,
val0)));
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/serialization/IgniteCacheSerializationManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/serialization/IgniteCacheSerializationManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/serialization/IgniteCacheSerializationManager.java
index 974cfd7..0f6ce2b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/serialization/IgniteCacheSerializationManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/serialization/IgniteCacheSerializationManager.java
@@ -32,12 +32,6 @@ public interface IgniteCacheSerializationManager<K, V> extends GridCacheManager<
      */
     public boolean portableEnabled();
 
-    /**
-     * @return {@code True} if portable format should be preserved when passing values to
cache store.
-     */
-    public boolean keepPortableInStore();
-
-
     public Object unwrapPortableIfNeeded(Object o, boolean keepPortable);
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java
index f2d6287..b33051e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableProcessor.java
@@ -49,14 +49,6 @@ public interface GridPortableProcessor extends GridProcessor {
     public int typeId(Object obj);
 
     /**
-     * @param arr Byte array.
-     * @param off Offset.
-     * @return Unmarshalled object.
-     * @throws IgniteException In case of error.
-     */
-    public Object unmarshal(byte[] arr, int off) throws IgniteException;
-
-    /**
      * Converts temporary offheap object to heap-based.
      *
      * @param ctx Context.
@@ -95,13 +87,6 @@ public interface GridPortableProcessor extends GridProcessor {
     public boolean isPortable(GridClientMarshaller marsh);
 
     /**
-     * @param node Node to check.
-     * @param cacheName Cache name to check.
-     * @return {@code True} if portable enabled for the specified cache, {@code false} otherwise.
-     */
-    public boolean portableEnabled(ClusterNode node, String cacheName);
-
-    /**
      * Checks whether object is portable object.
      *
      * @param obj Object to check.
@@ -110,14 +95,6 @@ public interface GridPortableProcessor extends GridProcessor {
     public boolean isPortableObject(Object obj);
 
     /**
-     * Gets affinity key of portable object.
-     *
-     * @param obj Object to get affinity key for.
-     * @return Affinity key.
-     */
-    public Object affinityKey(Object obj);
-
-    /**
      * @param obj Portable object to get field from.
      * @param fieldName Field name.
      * @return Field value.
@@ -184,7 +161,6 @@ public interface GridPortableProcessor extends GridProcessor {
     /**
      * @param ctx Cache context.
      * @param obj Key value.
-     * @param bytes Optional key bytes.
      * @return Cache key object.
      */
     public KeyCacheObject toCacheKeyObject(CacheObjectContext ctx, Object obj);
@@ -195,4 +171,9 @@ public interface GridPortableProcessor extends GridProcessor {
      *          with {@link IgniteImmutable} annotation.
      */
     public boolean immutable(Object obj);
+
+    /**
+     * @return {@code True} if portable format should be preserved when passing values to
cache store.
+     */
+    public boolean keepPortableInStore(@Nullable String cacheName);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
index 60eac93..53e7bb7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/IgniteCacheObjectProcessorAdapter.java
@@ -106,20 +106,16 @@ public abstract class IgniteCacheObjectProcessorAdapter extends GridProcessorAda
     {
         assert valPtr != 0;
 
-        long ptr = valPtr;
+        int size = UNSAFE.getInt(valPtr);
 
-        int size = UNSAFE.getInt(ptr);
+        byte type = UNSAFE.getByte(valPtr + 4);
 
-        ptr += 4;
-
-        byte type = UNSAFE.getByte(ptr++);
-
-        byte[] bytes = U.copyMemory(ptr, size);
+        byte[] bytes = U.copyMemory(valPtr + 5, size);
 
         if (ctx.kernalContext().config().isPeerClassLoadingEnabled() &&
             ctx.offheapTiered() &&
             type != CacheObjectAdapter.TYPE_BYTE_ARR) {
-            IgniteUuid valClsLdrId = U.readGridUuid(ptr + size);
+            IgniteUuid valClsLdrId = U.readGridUuid(valPtr + 5 + size);
 
             ClassLoader ldr =
                 valClsLdrId != null ? ctx.deploy().getClassLoader(valClsLdrId) : ctx.deploy().localLoader();
@@ -189,4 +185,9 @@ public abstract class IgniteCacheObjectProcessorAdapter extends GridProcessorAda
 
         return immutable;
     }
+
+    /** {@inheritDoc} */
+    @Override public boolean keepPortableInStore(@Nullable String cacheName) {
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84979b40/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java
index 1d0acb4..812cbb2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/os/GridOsPortableProcessor.java
@@ -49,10 +49,6 @@ public class GridOsPortableProcessor extends IgniteCacheObjectProcessorAdapter
{
         return 0;
     }
 
-    /** {@inheritDoc} */
-    @Nullable @Override public Object unmarshal(byte[] arr, int off) throws IgniteException
{
-        return null;
-    }
 
     /** {@inheritDoc} */
     @Override public Object unwrapTemporary(GridCacheContext ctx, Object obj) throws IgniteException
{
@@ -75,21 +71,11 @@ public class GridOsPortableProcessor extends IgniteCacheObjectProcessorAdapter
{
     }
 
     /** {@inheritDoc} */
-    @Override public boolean portableEnabled(ClusterNode node, String cacheName) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
     @Override public boolean isPortableObject(Object obj) {
         return false;
     }
 
     /** {@inheritDoc} */
-    @Override public Object affinityKey(Object obj) {
-        return obj;
-    }
-
-    /** {@inheritDoc} */
     @Override public int typeId(Object obj) {
         return 0;
     }


Mime
View raw message