You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/03/01 20:08:40 UTC

incubator-ignite git commit: # IGNITE-321 Fix CacheWriterTest.* tests.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-321 [created] 4f0eb9b19


# IGNITE-321 Fix CacheWriterTest.* tests.


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

Branch: refs/heads/ignite-321
Commit: 4f0eb9b193771bd25d72a4fd02eadd0d9ff6df80
Parents: 036bd71
Author: sevdokimov <se...@jetbrains.com>
Authored: Sun Mar 1 22:08:34 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Sun Mar 1 22:08:34 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheStoreManager.java | 12 +++----
 .../GridDistributedCacheAdapter.java            |  2 ++
 .../dataload/IgniteDataLoaderImpl.java          | 36 +++++++++++++++-----
 3 files changed, 35 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f0eb9b1/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 9262a8f..c768f54 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
@@ -616,6 +616,9 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                     handleClassCastException(e);
                 }
                 catch (Exception e) {
+                    if (!(e instanceof CacheWriterException))
+                        e = new CacheWriterException(e);
+
                     if (!entries.isEmpty()) {
                         List<Object> keys = new ArrayList<>(entries.size());
 
@@ -625,9 +628,6 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                         throw new CacheStorePartialUpdateException(keys, e);
                     }
 
-                    if (!(e instanceof CacheWriterException))
-                        e = new CacheWriterException(e);
-
                     throw new IgniteCheckedException(e);
                 }
                 finally {
@@ -725,12 +725,12 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 handleClassCastException(e);
             }
             catch (Exception e) {
-                if (!keys0.isEmpty())
-                    throw new CacheStorePartialUpdateException(keys0, e);
-
                 if (!(e instanceof CacheWriterException))
                     e = new CacheWriterException(e);
 
+                if (!keys0.isEmpty())
+                    throw new CacheStorePartialUpdateException(keys0, e);
+
                 throw new IgniteCheckedException(e);
             }
             finally {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f0eb9b1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
index dc82e83..00190d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
@@ -277,6 +277,8 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
                     dht = (GridDhtCacheAdapter<K, V>)cacheAdapter;
 
                 try (IgniteDataLoader<K, V> dataLdr = ignite.dataLoader(cacheName)) {
+                    ((IgniteDataLoaderImpl)dataLdr).maxRemapCount(0);
+
                     dataLdr.updater(GridDataLoadCacheUpdaters.<K, V>batched());
 
                     for (GridDhtLocalPartition<K, V> locPart : dht.topology().currentLocalPartitions()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f0eb9b1/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
index ced8d1d..c482f23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
@@ -66,7 +66,7 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
     private byte[] updaterBytes;
 
     /** Max remap count before issuing an error. */
-    private static final int MAX_REMAP_CNT = 32;
+    private static final int DFLT_MAX_REMAP_CNT = 32;
 
     /** Log reference. */
     private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
@@ -156,6 +156,9 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
     /** */
     private boolean skipStore;
 
+    /** */
+    private int maxRemapCnt = DFLT_MAX_REMAP_CNT;
+
     /**
      * @param ctx Grid kernal context.
      * @param cacheName Cache name.
@@ -434,12 +437,6 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
     ) {
         assert entries != null;
 
-        if (remaps >= MAX_REMAP_CNT) {
-            resFut.onDone(new IgniteCheckedException("Failed to finish operation (too many remaps): " + remaps));
-
-            return;
-        }
-
         Map<ClusterNode, Collection<Map.Entry<K, V>>> mappings = new HashMap<>();
 
         boolean initPda = ctx.deploy().enabled() && jobPda == null;
@@ -526,8 +523,15 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
                             resFut.onDone(new IgniteCheckedException("Data loader has been cancelled: " +
                                 IgniteDataLoaderImpl.this, e1));
                         }
-                        else
-                            load0(entriesForNode, resFut, activeKeys, remaps + 1);
+                        else {
+                            if (remaps + 1 > maxRemapCnt) {
+                                resFut.onDone(remaps == 0 ? e1
+                                    : new IgniteCheckedException("Failed to finish operation (too many remaps): "
+                                    + remaps));
+                            }
+                            else
+                                load0(entriesForNode, resFut, activeKeys, remaps + 1);
+                        }
                     }
                 }
             };
@@ -760,6 +764,20 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay
         close(false);
     }
 
+    /**
+     * @return Max remap count.
+     */
+    public int maxRemapCount() {
+        return maxRemapCnt;
+    }
+
+    /**
+     * @param maxRemapCnt New max remap count.
+     */
+    public void maxRemapCount(int maxRemapCnt) {
+        this.maxRemapCnt = maxRemapCnt;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgniteDataLoaderImpl.class, this);