ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-db-x-10884
Date Fri, 22 Apr 2016 08:12:23 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-db-x-10884 49543e167 -> f61c260b3


ignite-db-x-10884


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

Branch: refs/heads/ignite-db-x-10884
Commit: f61c260b314c77633cf2c04dd6e2c3c67c8c28db
Parents: 49543e1
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Apr 22 11:12:10 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Apr 22 11:12:10 2016 +0300

----------------------------------------------------------------------
 .../cache/GridCacheClearAllRunnable.java        |  30 +-
 .../cache/GridCacheDeploymentManager.java       |   4 +-
 .../processors/cache/GridCacheMapEntry.java     |   2 +-
 .../processors/cache/GridCacheSwapManager.java  | 343 -------------------
 .../cache/IgniteCacheOffheapManager.java        |  72 +++-
 .../distributed/dht/GridDhtLocalPartition.java  |  55 +--
 .../cache/query/GridCacheQueryManager.java      |  13 +-
 7 files changed, 103 insertions(+), 416 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
index f6684d6..4f40c3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
@@ -87,23 +87,23 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable
{
 
         // Clear swapped entries.
         if (!ctx.isNear()) {
-            // TODO GG-10884.
+            // TODO GG-10884: need pass old value to indexing + honor 'owns(key)'.
             ctx.offheap().clear(readers);
 
-            if (ctx.swap().offHeapEnabled()) {
-                if (GridQueryProcessor.isEnabled(ctx.config())) {
-                    for (Iterator<KeyCacheObject> it =
-                        ctx.swap().offHeapKeyIterator(true, true, AffinityTopologyVersion.NONE);
it.hasNext();) {
-                        KeyCacheObject key = it.next();
-
-                        if (owns(key))
-                            clearEntry(cache.entryEx(key));
-
-                    }
-                }
-                else if (id == 0)
-                    ctx.swap().clearOffHeap();
-            }
+//            if (ctx.swap().offHeapEnabled()) {
+//                if (GridQueryProcessor.isEnabled(ctx.config())) {
+//                    for (Iterator<KeyCacheObject> it =
+//                        ctx.swap().offHeapKeyIterator(true, true, AffinityTopologyVersion.NONE);
it.hasNext();) {
+//                        KeyCacheObject key = it.next();
+//
+//                        if (owns(key))
+//                            clearEntry(cache.entryEx(key));
+//
+//                    }
+//                }
+//                else if (id == 0)
+//                    ctx.swap().clearOffHeap();
+//            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
index d7f7521..39fad4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
@@ -273,9 +273,7 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
             qryMgr.onUndeploy(ldr);
 
         // Examine swap for entries to undeploy.
-        int swapUndeployCnt = cacheCtx.isNear() ?
-            cacheCtx.near().dht().context().swap().onUndeploy(ldr) :
-            cacheCtx.swap().onUndeploy(ldr);
+        int swapUndeployCnt = cacheCtx.offheap().onUndeploy(ldr);
 
         if (cacheCtx.userCache() && (!keys.isEmpty() || swapUndeployCnt != 0)) {
             U.quietAndWarn(log, "");

http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/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 48e6456..d9c81b6 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
@@ -2907,7 +2907,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
         synchronized (this) {
             checkObsolete();
 
-            if ((isNew() && !cctx.swap().containsKey(key, partition())) || (!preload
&& deletedUnlocked())) {
+            if ((isNew() && !cctx.offheap().containsKey(key, partition())) || (!preload
&& deletedUnlocked())) {
                 long expTime = expireTime < 0 ? CU.toExpireTime(ttl) : expireTime;
 
                 val = cctx.kernalContext().cacheObjects().prepareForCache(val, cctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/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 7ff6a77..8907a9a 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
@@ -217,70 +217,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     }
 
     /**
-     * @return Swap size.
-     * @throws IgniteCheckedException If failed.
-     */
-    public long swapSize() throws IgniteCheckedException {
-        return enabled ? swapMgr.swapSize(spaceName) : -1;
-    }
-
-    /**
-     * @param primary If {@code true} includes primary entries.
-     * @param backup If {@code true} includes backup entries.
-     * @param topVer Topology version.
-     * @return Number of swap entries.
-     * @throws IgniteCheckedException If failed.
-     */
-    public int swapEntriesCount(boolean primary, boolean backup, AffinityTopologyVersion
topVer) throws IgniteCheckedException {
-        assert primary || backup;
-
-        if (!swapEnabled)
-            return 0;
-
-        if (!(primary && backup)) {
-            Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
topVer) :
-                cctx.affinity().backupPartitions(cctx.localNodeId(), topVer);
-
-            return (int)swapMgr.swapKeys(spaceName, parts);
-        }
-        else
-            return (int)swapMgr.swapKeys(spaceName);
-    }
-
-    /**
-     * @param primary If {@code true} includes primary entries.
-     * @param backup If {@code true} includes backup entries.
-     * @param topVer Topology version.
-     * @return Number of offheap entries.
-     * @throws IgniteCheckedException If failed.
-     */
-    public int offheapEntriesCount(boolean primary, boolean backup, AffinityTopologyVersion
topVer) throws IgniteCheckedException {
-        assert primary || backup;
-
-        if (!offheapEnabled)
-            return 0;
-
-        if (!(primary && backup)) {
-            Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
topVer) :
-                cctx.affinity().backupPartitions(cctx.localNodeId(), topVer);
-
-            return (int)offheap.entriesCount(spaceName, parts);
-        }
-        else
-            return (int)offheap.entriesCount(spaceName);
-    }
-
-    /**
-     * Gets number of swap entries (keys).
-     *
-     * @return Swap keys count.
-     * @throws IgniteCheckedException If failed.
-     */
-    public long swapKeys() throws IgniteCheckedException {
-        return enabled ? swapMgr.swapKeys(spaceName) : -1;
-    }
-
-    /**
      * @param part Partition.
      * @param key Cache key.
      * @param e Entry.
@@ -468,45 +404,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     }
 
     /**
-     * @param key Key to check.
-     * @param part Partition.
-     * @return {@code True} if key is contained.
-     * @throws IgniteCheckedException If failed.
-     */
-    public boolean containsKey(KeyCacheObject key, int part) throws IgniteCheckedException
{
-        if (!offheapEnabled && !swapEnabled)
-            return false;
-
-        checkIteratorQueue();
-
-        // First check off-heap store.
-        if (offheapEnabled) {
-            boolean contains = offheap.contains(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
-
-            if (cctx.config().isStatisticsEnabled())
-                cctx.cache().metrics0().onOffHeapRead(contains);
-
-            if (contains)
-                return true;
-        }
-
-        if (swapEnabled) {
-            assert key != null;
-
-            byte[] valBytes = swapMgr.read(spaceName,
-                new SwapKey(key, part, key.valueBytes(cctx.cacheObjectContext())),
-                cctx.deploy().globalLoader());
-
-            if (cctx.config().isStatisticsEnabled())
-                cctx.cache().metrics0().onSwapRead(valBytes != null);
-
-            return valBytes != null;
-        }
-
-        return false;
-    }
-
-    /**
      * @param key Key to read.
      * @param keyBytes Key bytes.
      * @param part Key partition.
@@ -779,18 +676,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     }
 
     /**
-     * @param entry Entry to read.
-     * @return Read value.
-     * @throws IgniteCheckedException If read failed.
-     */
-    @Nullable GridCacheSwapEntry readAndRemove(GridCacheEntryEx entry) throws IgniteCheckedException
{
-        if (!offheapEnabled && !swapEnabled)
-            return null;
-
-        return readAndRemove(entry.key());
-    }
-
-    /**
      * @param key Key.
      * @param keyBytes Key bytes.
      * @param part Partition.
@@ -1430,99 +1315,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     }
 
     /**
-     * Gets offheap and swap iterator over partition.
-     *
-     * @return Iterator over partition.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawIterator()
-        throws IgniteCheckedException {
-        if (!offHeapEnabled())
-            return new GridEmptyCloseableIterator<>();
-
-        checkIteratorQueue();
-
-        if (offHeapEnabled())
-            return rawOffHeapIterator(null, true, true);
-
-        if (!offHeapEnabled())
-            return rawSwapIterator(true, true);
-
-        // Both, swap and off-heap are enabled.
-        return new GridCloseableIteratorAdapter<Map.Entry<byte[], byte[]>>()
{
-            private GridCloseableIterator<Map.Entry<byte[], byte[]>> it;
-
-            private boolean offheapFlag = true;
-
-            private boolean done;
-
-            private Map.Entry<byte[], byte[]> cur;
-
-            {
-                it = rawOffHeapIterator(null, true, true);
-
-                advance();
-            }
-
-            private void advance() throws IgniteCheckedException {
-                if (it.hasNext())
-                    return;
-
-                it.close();
-
-                if (offheapFlag) {
-                    offheapFlag = false;
-
-                    it = rawSwapIterator(true, true);
-
-                    if (!it.hasNext()) {
-                        it.close();
-
-                        done = true;
-                    }
-                }
-                else
-                    done = true;
-            }
-
-            @Override protected Map.Entry<byte[], byte[]> onNext() throws IgniteCheckedException
{
-                if (done)
-                    throw new NoSuchElementException();
-
-                cur = it.next();
-
-                advance();
-
-                return cur;
-            }
-
-            @Override protected boolean onHasNext() {
-                return !done;
-            }
-
-            @Override protected void onRemove() throws IgniteCheckedException {
-                if (offheapFlag) {
-                    KeyCacheObject key = cctx.toCacheKeyObject(cur.getKey());
-
-                    int part = cctx.affinity().partition(key);
-
-                    boolean rmv = offheap.removex(spaceName, part, key, key.valueBytes(cctx.cacheObjectContext()));
-
-                    if(rmv && cctx.config().isStatisticsEnabled())
-                        cctx.cache().metrics0().onOffHeapRemove();
-                }
-                else
-                    it.removeX();
-            }
-
-            @Override protected void onClose() throws IgniteCheckedException {
-                if (it != null)
-                    it.close();
-            }
-        };
-    }
-
-    /**
      * @return Lazy swap iterator.
      * @throws IgniteCheckedException If failed.
      */
@@ -1952,141 +1744,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter
{
     }
 
     /**
-     * @param primary If {@code true} includes primary entries.
-     * @param backup If {@code true} includes backup entries.
-     * @param topVer Topology version.
-     * @return Swap entries iterator.
-     * @throws IgniteCheckedException If failed.
-     */
-    public <K, V> Iterator<Cache.Entry<K, V>> swapIterator(boolean primary,
boolean backup, AffinityTopologyVersion topVer)
-        throws IgniteCheckedException
-    {
-        assert primary || backup;
-
-        if (!swapEnabled)
-            return F.emptyIterator();
-
-        if (primary && backup)
-            return cacheEntryIterator(this.<K, V>lazySwapIterator());
-
-        Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
topVer) :
-            cctx.affinity().backupPartitions(cctx.localNodeId(), topVer);
-
-        return new PartitionsIterator<K, V>(parts) {
-            @Override protected GridCloseableIterator<? extends Map.Entry<byte[], byte[]>>
nextPartition(int part)
-                throws IgniteCheckedException
-            {
-                return swapMgr.rawIterator(spaceName, part);
-            }
-        };
-    }
-
-    /**
-     * @param primary If {@code true} includes primary entries.
-     * @param backup If {@code true} includes backup entries.
-     * @param topVer Topology version.
-     * @return Offheap entries iterator.
-     * @throws IgniteCheckedException If failed.
-     */
-    public <K, V> Iterator<Cache.Entry<K, V>> offheapIterator(boolean primary,
-        boolean backup,
-        AffinityTopologyVersion topVer)
-        throws IgniteCheckedException
-    {
-        assert primary || backup;
-
-        if (!offheapEnabled)
-            return F.emptyIterator();
-
-        if (primary && backup)
-            return cacheEntryIterator(this.<K, V>lazyOffHeapIterator());
-
-        Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
topVer) :
-            cctx.affinity().backupPartitions(cctx.localNodeId(), topVer);
-
-        return new PartitionsIterator<K, V>(parts) {
-            @Override protected GridCloseableIterator<? extends Map.Entry<byte[], byte[]>>
nextPartition(int part) {
-                return offheap.iterator(spaceName, part);
-            }
-        };
-    }
-
-    /**
-     * @param ldr Undeployed class loader.
-     * @return Undeploy count.
-     */
-    public int onUndeploy(ClassLoader ldr) {
-        IgniteUuid ldrId = cctx.deploy().getClassLoaderId(ldr);
-
-        assert ldrId != null;
-
-        checkIteratorQueue();
-
-        try {
-            GridCloseableIterator<Map.Entry<byte[], byte[]>> iter = rawIterator();
-
-            if (iter != null) {
-                int undeployCnt = 0;
-
-                try {
-                    for (Map.Entry<byte[], byte[]> e : iter) {
-                        try {
-                            GridCacheSwapEntry swapEntry = unmarshalSwapEntry(e.getValue(),
false);
-
-                            IgniteUuid valLdrId = swapEntry.valueClassLoaderId();
-
-                            if (ldrId.equals(swapEntry.keyClassLoaderId())) {
-                                iter.removeX();
-
-                                undeployCnt++;
-                            }
-                            else {
-                                if (valLdrId == null &&
-                                    swapEntry.value() == null &&
-                                    swapEntry.type() != CacheObject.TYPE_BYTE_ARR) {
-                                    // We need value here only for classloading purposes.
-                                    Object val =  cctx.cacheObjects().unmarshal(cctx.cacheObjectContext(),
-                                        swapEntry.valueBytes(),
-                                        cctx.deploy().globalLoader());
-
-                                    if (val != null)
-                                        valLdrId = cctx.deploy().getClassLoaderId(val.getClass().getClassLoader());
-                                }
-
-                                if (ldrId.equals(valLdrId)) {
-                                    iter.removeX();
-
-                                    undeployCnt++;
-                                }
-                            }
-                        }
-                        catch (Exception ex) {
-                            U.error(log, "Failed to process swap entry.", ex);
-                        }
-                    }
-                }
-                finally {
-                    iter.close();
-                }
-
-                return undeployCnt;
-            }
-        }
-        catch (IgniteCheckedException e) {
-            U.error(log, "Failed to clear cache swap space on undeploy.", e);
-        }
-
-        return 0;
-    }
-
-    /**
-     * @return Swap space name.
-     */
-    public String spaceName() {
-        return spaceName;
-    }
-
-    /**
      * @param bytes Bytes to unmarshal.
      * @param valOnly If {@code true} unmarshalls only value.
      * @return Unmarshalled entry.

http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index cd16420..510c47e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -73,7 +73,6 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter {
     private final boolean indexingEnabled;
 
     /**
-     * @param enabled Enabled flag (offheap supposed to be disabled for near cache).
      * @param indexingEnabled {@code True} if indexing is enabled for cache.
      */
     public IgniteCacheOffheapManager(boolean indexingEnabled) {
@@ -99,6 +98,20 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
     }
 
     /**
+     * TODO: GG-10884, used on only from initialValue.
+     */
+    public boolean containsKey(KeyCacheObject key, int part) {
+        try {
+            return read(key, part) != null;
+        }
+        catch (IgniteCheckedException e) {
+            U.error(log, "Failed to read value", e);
+
+            return false;
+        }
+    }
+
+    /**
      * @param key Key.
      * @param val Value.
      * @param ver Version.
@@ -188,6 +201,11 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
         }
     }
 
+    public int onUndeploy(ClassLoader ldr) {
+        // TODO: GG-10884.
+        return 0;
+    }
+
     /**
      * @param tree Tree.
      * @param readers {@code True} to clear readers.
@@ -309,9 +327,55 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
         return 0;
     }
 
-    public <K, V> GridIterator<IgniteBiTuple<K, V>> scanQueryIterator(@Nullable
IgniteBiPredicate<K, V> filter) {
-        // TODO GG-10884.
-        return new GridEmptyIterator<>();
+    public <K, V> GridIterator<IgniteBiTuple<K, V>> scanQueryIterator(@Nullable
final IgniteBiPredicate<K, V> filter, final boolean keepBinary)
+        throws IgniteCheckedException {
+        final GridCursor<? extends CacheDataRow> cur = dataTree.find(null, null);
+
+        return new GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
+            private IgniteBiTuple<K, V> next;
+
+            private void advance() throws IgniteCheckedException {
+                if (next != null)
+                    return;
+
+                CacheDataRow row = null;
+
+                if (filter != null) {
+                    while (cur.next()) {
+                        row = cur.get();
+
+                        K key = (K)cctx.unwrapBinaryIfNeeded(row.key(), keepBinary);
+                        V val = (V)cctx.unwrapBinaryIfNeeded(row.value(), keepBinary);
+
+                        if (!filter.apply(key, val))
+                            continue;
+
+                        break;
+                    }
+                }
+                else {
+                    if (cur.next())
+                        row = cur.get();
+                }
+
+                if (row != null)
+                    next = new IgniteBiTuple<>((K)row.key(), (V)row.value());
+            }
+
+            @Override protected IgniteBiTuple<K, V> onNext() throws IgniteCheckedException
{
+                IgniteBiTuple<K, V> res = next;
+
+                next = null;
+
+                return res;
+            }
+
+            @Override protected boolean onHasNext() throws IgniteCheckedException {
+                advance();
+
+                return next != null;
+            }
+        };
     }
 
     public <K, V> GridCloseableIterator<Cache.Entry<K, V>> entriesIterator(boolean
primary, boolean backup, AffinityTopologyVersion topVer)

http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index bba2a03..5ee9dfc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -661,22 +661,24 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
 
         Iterator<GridDhtCacheEntry> it = map.values().iterator();
 
+        // TODO GG-10884: need pass old value to indexing?
         GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> swapIt =
null;
-
-        if (swap && GridQueryProcessor.isEnabled(cctx.config())) { // Indexing needs
to unswap cache values.
-            Iterator<GridDhtCacheEntry> unswapIt = null;
-
-            try {
-                swapIt = cctx.swap().iterator(id);
-                unswapIt = unswapIterator(swapIt);
-            }
-            catch (Exception e) {
-                U.error(log, "Failed to clear swap for evicted partition: " + this, e);
-            }
-
-            if (unswapIt != null)
-                it = F.concat(it, unswapIt);
-        }
+//        GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> swapIt
= null;
+//
+//        if (swap && GridQueryProcessor.isEnabled(cctx.config())) { // Indexing
needs to unswap cache values.
+//            Iterator<GridDhtCacheEntry> unswapIt = null;
+//
+//            try {
+//                swapIt = cctx.swap().iterator(id);
+//                unswapIt = unswapIterator(swapIt);
+//            }
+//            catch (Exception e) {
+//                U.error(log, "Failed to clear swap for evicted partition: " + this, e);
+//            }
+//
+//            if (unswapIt != null)
+//                it = F.concat(it, unswapIt);
+//        }
 
         GridCacheObsoleteEntryExtras extras = new GridCacheObsoleteEntryExtras(clearVer);
 
@@ -714,7 +716,6 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
                 }
                 catch (GridDhtInvalidPartitionException e) {
                     assert map.isEmpty() && state() == EVICTED: "Invalid error [e="
+ e + ", part=" + this + ']';
-                    assert swapEmpty() : "Invalid error when swap is not cleared [e=" + e
+ ", part=" + this + ']';
 
                     break; // Partition is already concurrently cleared and evicted.
                 }
@@ -729,28 +730,6 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     }
 
     /**
-     * @return {@code True} if there are no swap entries for this partition.
-     */
-    private boolean swapEmpty() {
-        GridCloseableIterator<?> it0 = null;
-
-        try {
-            it0 = cctx.swap().iterator(id);
-
-            return it0 == null || !it0.hasNext();
-        }
-        catch (IgniteCheckedException e) {
-            U.error(log, "Failed to get partition swap iterator: " + this, e);
-
-            return true;
-        }
-        finally {
-            if (it0 != null)
-                U.closeQuiet(it0);
-        }
-    }
-
-    /**
      * @param it Swap iterator.
      * @return Unswapping iterator over swapped entries.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/f61c260b/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 a845dcb..205dec6 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
@@ -996,7 +996,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
                 iters.add(heapIt);
 
-                iters.add(offheapIterator(qry, backups));
+                //iters.add(offheapIterator(qry, backups));
 
                 it = new CompoundIterator<>(iters);
             }
@@ -1045,17 +1045,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     }
 
     /**
-     * @param qry Query.
-     * @param backups Include backups.
-     * @return Offheap iterator.
-     */
-    private GridIterator<IgniteBiTuple<K, V>> offheapIterator(GridCacheQueryAdapter<?>
qry, boolean backups) {
-        IgniteBiPredicate<K, V> filter = qry.scanFilter();
-
-        return cctx.offheap().scanQueryIterator(filter);
-    }
-
-    /**
      * @param it Lazy swap or offheap iterator.
      * @param filter Scan filter.
      * @param keepBinary Keep binary flag.


Mime
View raw message