ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-4535 - Restore localPromote()
Date Wed, 19 Apr 2017 08:02:22 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4535 4bb5f459e -> 939ff399d


IGNITE-4535 - Restore localPromote()


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/939ff399
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/939ff399
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/939ff399

Branch: refs/heads/ignite-4535
Commit: 939ff399da358a189d7e4b8b3fdc1392b90b4b0f
Parents: 4bb5f45
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Wed Apr 19 11:02:53 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Wed Apr 19 11:02:53 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 34 ++++++++++++++++++++
 .../processors/cache/GridCacheProxyImpl.java    | 12 +++++++
 .../processors/cache/IgniteCacheProxy.java      | 12 +++++--
 .../processors/cache/IgniteInternalCache.java   |  7 ++++
 .../distributed/near/GridNearCacheAdapter.java  |  5 +++
 .../cache/hibernate/HibernateCacheProxy.java    |  5 +++
 .../cache/hibernate/HibernateCacheProxy.java    |  5 +++
 7 files changed, 78 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/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 b38e481..0257797 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
@@ -4451,6 +4451,40 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public void localPromote(Collection<? extends K> keys) {
+        if (!F.isEmpty(keys)) {
+            for (K key : keys) {
+                while (true) {
+                    GridCacheEntryEx e = null;
+
+                    try {
+                        e = entryEx(key);
+
+                        e.unswap();
+
+                        break;
+                    }
+                    catch (GridCacheEntryRemovedException ignore) {
+                        // Retry.
+                    }
+                    catch (GridDhtInvalidPartitionException ignore) {
+                        break;
+                    }
+                    catch (IgniteCheckedException ex) {
+                        U.error(log, "Failed to promote key to on-heap storage: " + key,
ex);
+
+                        break;
+                    }
+                    finally {
+                        if (e != null)
+                            ctx.evicts().touch(e, AffinityTopologyVersion.NONE);
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * @param filter Filters to evaluate.
      * @return Entry set.

http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index eaa448f..40cdc5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -1042,6 +1042,18 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
     }
 
     /** {@inheritDoc} */
+    @Override public void localPromote(Collection<? extends K> keys) {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            delegate.localPromote(keys);
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
         CacheOperationContext prev = gate.enter(opCtx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 98f2f93..5bbdba6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -1015,8 +1015,16 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
 
     /** {@inheritDoc} */
     @Override public void localPromote(Set<? extends K> keys) throws CacheException
{
-        // TODO GG-11148.
-        throw new UnsupportedOperationException("localPromote will be removed");
+        GridCacheGateway<K, V> gate = this.gate;
+
+        CacheOperationContext prev = onEnter(gate, opCtx);
+
+        try {
+            delegate.localPromote(keys);
+        }
+        finally {
+            onLeave(gate, prev);
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index ca8c7fc..cc4af18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -1009,6 +1009,13 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K,
V>> {
     public void evictAll(@Nullable Collection<? extends K> keys);
 
     /**
+     * Attempts to create an on-heap copy of the key-value mapping for the keys provided.
+     *
+     * @param keys Keys to promote.
+     */
+    public void localPromote(Collection<? extends K> keys);
+
+    /**
      * Clears all entries from this cache only if the entry is not
      * currently locked or participating in a transaction.
      * <p>

http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git 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
index f4ba043..3991489 100644
--- 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
@@ -371,6 +371,11 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
     }
 
     /** {@inheritDoc} */
+    @Override public void localPromote(Collection<? extends K> keys) {
+        dht().localPromote(keys);
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean clearLocally(K key) {
         return super.clearLocally(key) | dht().clearLocally(key);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
index c814f9a..ac7eccb 100644
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
@@ -337,6 +337,11 @@ public class HibernateCacheProxy implements IgniteInternalCache<Object,
Object>
     }
 
     /** {@inheritDoc} */
+    @Override public void localPromote(Collection keys) {
+        delegate.localPromote(transform(keys));
+    }
+
+    /** {@inheritDoc} */
     @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
         delegate.clearLocally(srv, near, readers);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/939ff399/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
index c814f9a..ac7eccb 100644
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
@@ -337,6 +337,11 @@ public class HibernateCacheProxy implements IgniteInternalCache<Object,
Object>
     }
 
     /** {@inheritDoc} */
+    @Override public void localPromote(Collection keys) {
+        delegate.localPromote(transform(keys));
+    }
+
+    /** {@inheritDoc} */
     @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
         delegate.clearLocally(srv, near, readers);
     }


Mime
View raw message