ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/6] incubator-ignite git commit: #ignite-286: OffHeap processor iterator takes partitions.
Date Mon, 27 Apr 2015 14:38:56 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-286 4502b6102 -> 9373e43da


#ignite-286: OffHeap processor iterator takes partitions.


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

Branch: refs/heads/ignite-286
Commit: ba4f12a1f1b12badb232920dae725b854349bd8d
Parents: 4502b61
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Apr 27 16:34:13 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Apr 27 16:34:13 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheSwapManager.java      |  9 ++++++---
 .../processors/offheap/GridOffHeapProcessor.java    |  5 +++--
 .../util/offheap/GridOffHeapPartitionedMap.java     |  3 ++-
 .../offheap/unsafe/GridUnsafePartitionedMap.java    |  6 +++---
 .../GridOffHeapPartitionedMapAbstractSelfTest.java  | 16 ++++++++++++----
 5 files changed, 26 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4f12a1/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 cd59e27..4235688 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
@@ -1321,7 +1321,8 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
             return F.emptyIterator();
 
         if (primary && backup)
-            return keyIterator(offheap.iterator(spaceName));
+            return keyIterator(offheap.iterator(spaceName,
+                cctx.grid().affinity(cctx.name()).allPartitions(cctx.grid().localNode())));
 
         Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(),
topVer) :
             cctx.affinity().backupPartitions(cctx.localNodeId(), topVer);
@@ -1367,7 +1368,8 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         if (!offheapEnabled)
             return new GridEmptyCloseableIterator<>();
 
-        return lazyIterator(offheap.iterator(spaceName));
+        return lazyIterator(offheap.iterator(spaceName,
+            cctx.grid().affinity(cctx.name()).allPartitions(cctx.grid().localNode())));
     }
 
     /**
@@ -1587,7 +1589,8 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         if (!offheapEnabled)
             return new GridEmptyCloseableIterator<>();
 
-        return new OffHeapIterator(offheap.iterator(spaceName));
+        return new OffHeapIterator(offheap.iterator(spaceName,
+            cctx.grid().affinity(cctx.name()).allPartitions(cctx.grid().localNode())));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4f12a1/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
index ebedadb..20da1eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/offheap/GridOffHeapProcessor.java
@@ -268,12 +268,13 @@ public class GridOffHeapProcessor extends GridProcessorAdapter {
      * Gets iterator over contents of the given space.
      *
      * @param spaceName Space name.
+     * @param parts Partitions.
      * @return Iterator.
      */
-    public GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> iterator(@Nullable
String spaceName) {
+    public GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> iterator(@Nullable
String spaceName, int[] parts) {
         GridOffHeapPartitionedMap m = offheap(spaceName);
 
-        return m == null ? new GridEmptyCloseableIterator<IgniteBiTuple<byte[], byte[]>>()
: m.iterator();
+        return m == null ? new GridEmptyCloseableIterator<IgniteBiTuple<byte[], byte[]>>()
: m.iterator(parts);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4f12a1/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
index 49850ab..9478b1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMap.java
@@ -188,9 +188,10 @@ public interface GridOffHeapPartitionedMap {
     /**
      * Gets iterator over the whole map.
      *
+     * @param parts Partitions.
      * @return Iterator over the whole map.
      */
-    public GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> iterator();
+    public GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> iterator(int[]
parts);
 
     /**
      * Gets iterator over the whole map.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4f12a1/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
index ba67b30..cd993c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafePartitionedMap.java
@@ -276,7 +276,7 @@ public class GridUnsafePartitionedMap implements GridOffHeapPartitionedMap
{
     }
 
     /** {@inheritDoc} */
-    @Override public GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> iterator()
{
+    @Override public GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> iterator(final
int[] parts) {
         return new GridCloseableIteratorAdapter<IgniteBiTuple<byte[], byte[]>>()
{
             private int p;
 
@@ -294,8 +294,8 @@ public class GridUnsafePartitionedMap implements GridOffHeapPartitionedMap
{
             private void advance() throws IgniteCheckedException {
                 curIt = null;
 
-                while (p < parts) {
-                    curIt = mapFor(p++).iterator();
+                while (p < parts.length) {
+                    curIt = mapFor(parts[p++]).iterator();
 
                     if (curIt.hasNext())
                         return;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4f12a1/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
index 265beda..eb0525b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/offheap/GridOffHeapPartitionedMapAbstractSelfTest.java
@@ -64,11 +64,19 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends
GridComm
     /** */
     protected int parts = 17;
 
+    /** */
+    protected int[] allParts;
+
     /**
      *
      */
     protected GridOffHeapPartitionedMapAbstractSelfTest() {
         super(false);
+
+        allParts = new int[parts];
+
+        for (int i = 0; i < parts; ++i)
+            allParts[i] = i;
     }
 
     /** {@inheritDoc} */
@@ -452,7 +460,7 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends
GridComm
 
         int cnt = 0;
 
-        try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it = map.iterator())
{
+        try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it = map.iterator(allParts))
{
             while (it.hasNext()) {
                 IgniteBiTuple<byte[], byte[]> t = it.next();
 
@@ -530,7 +538,7 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends
GridComm
                     assertEquals(new String(map.get(p, hash(key), key.getBytes())), val);
                 }
 
-                try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it
= map.iterator()) {
+                try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it
= map.iterator(allParts)) {
                     while (it.hasNext()) {
                         IgniteBiTuple<byte[], byte[]> t = it.next();
 
@@ -549,7 +557,7 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends
GridComm
 
         int cnt = 0;
 
-        try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it = map.iterator())
{
+        try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>> it = map.iterator(allParts))
{
             while (it.hasNext()) {
                 IgniteBiTuple<byte[], byte[]> t = it.next();
 
@@ -600,7 +608,7 @@ public abstract class GridOffHeapPartitionedMapAbstractSelfTest extends
GridComm
             @Override public void run() {
                 try {
                     while (running.get()) {
-                        try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>>
it = map.iterator()) {
+                        try (GridCloseableIterator<IgniteBiTuple<byte[], byte[]>>
it = map.iterator(allParts)) {
                             while (it.hasNext()) {
                                 IgniteBiTuple<byte[], byte[]> tup = it.next();
 


Mime
View raw message