ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # ignite-746-debug
Date Wed, 15 Apr 2015 15:08:11 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-746-debug 791f4eef8 -> 36dca802e


# ignite-746-debug


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

Branch: refs/heads/ignite-746-debug
Commit: 36dca802ecb0ee7bbbc61b2aab964ed08efd7216
Parents: 791f4ee
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Apr 15 17:52:49 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Apr 15 18:08:01 2015 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 120 ++++++-------------
 ...eAtomicInvalidPartitionHandlingSelfTest.java |  71 ++++-------
 2 files changed, 62 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36dca802/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 1785cfd..188e75d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -240,21 +240,25 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
     /** {@inheritDoc} */
     @Override public boolean onNodeLeft(UUID nodeId) {
-        for (Object o : keys) {
-            Object key0;
-
-            if (o instanceof KeyCacheObject)
-                key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-            else
-                key0 = o;
-
-            TestDebugLog.addEntryMessage(key0, null, "nodeLeft");
-        }
+//        for (Object o : keys) {
+//            Object key0;
+//
+//            if (o instanceof KeyCacheObject)
+//                key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
+//            else
+//                key0 = o;
+//
+//            TestDebugLog.addEntryMessage(key0, null, "nodeLeft");
+//        }
+
+        TestDebugLog.addEntryMessage(version(), null, "nodeLeft " + nodeId);
 
         Boolean single0 = single;
 
         if (single0 != null && single0) {
             if (singleNodeId.equals(nodeId)) {
+                TestDebugLog.addEntryMessage(version(), null, "node left single " + nodeId);
+
                 onDone(addFailedKeys(
                     singleReq.keys(),
                     new ClusterTopologyCheckedException("Primary node left grid before response
is received: " + nodeId)));
@@ -271,6 +275,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             addFailedKeys(req.keys(), new ClusterTopologyCheckedException("Primary node left
grid before response is " +
                 "received: " + nodeId));
 
+            TestDebugLog.addEntryMessage(version(), null, "node left remove mapping " + nodeId);
+
             mappings.remove(nodeId);
 
             checkComplete();
@@ -285,9 +291,16 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
     @Override public void checkTimeout(long timeout) {
         long mapTime0 = mapTime;
 
-        if (mapTime0 > 0 && U.currentTimeMillis() > mapTime0 + timeout)
+        if (mapTime0 > 0 && U.currentTimeMillis() > mapTime0 + timeout) {
+            TestDebugLog.addEntryMessage(version(), null, "timeout: " + timeout);
+
+            TestDebugLog.printKeyMessages(false, version());
+
+            System.exit(33);
+
             onDone(new CacheAtomicUpdateTimeoutCheckedException("Cache update timeout out
" +
                 "(consider increasing networkTimeout configuration property)."));
+        }
     }
 
     /** {@inheritDoc} */
@@ -340,16 +353,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
      */
     public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res) {
         if (res.remapKeys() != null) {
-            for (Object o : res.remapKeys()) {
-                Object key0;
-
-                if (o instanceof KeyCacheObject)
-                    key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-                else
-                    key0 = o;
-
-                TestDebugLog.addEntryMessage(key0, null, "remap");
-            }
+            TestDebugLog.addEntryMessage(version(), null, "remap");
 
             assert cctx.config().getAtomicWriteOrderMode() == PRIMARY;
 
@@ -363,16 +367,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         Boolean single0 = single;
 
         if (single0 != null && single0) {
-            for (Object o : keys) {
-                Object key0;
-
-                if (o instanceof KeyCacheObject)
-                    key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-                else
-                    key0 = o;
-
-                TestDebugLog.addEntryMessage(key0, null, "single response");
-            }
+            TestDebugLog.addEntryMessage(version(), null, "single response " + nodeId);
 
             assert singleNodeId.equals(nodeId) : "Invalid response received for single-node
mapped future " +
                 "[singleNodeId=" + singleNodeId + ", nodeId=" + nodeId + ", res=" + res +
']';
@@ -398,16 +393,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         else {
             GridNearAtomicUpdateRequest req = mappings.get(nodeId);
 
-            for (Object o : keys) {
-                Object key0;
-
-                if (o instanceof KeyCacheObject)
-                    key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-                else
-                    key0 = o;
-
-                TestDebugLog.addEntryMessage(key0, null, "response");
-            }
+            TestDebugLog.addEntryMessage(version(), null, "response " + nodeId);
 
             if (req != null) { // req can be null if onResult is being processed concurrently
with onNodeLeft.
                 updateNear(req, res);
@@ -516,6 +502,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             else
                 onDone(opRes);
         }
+        else
+            TestDebugLog.addEntryMessage(version(), null, "check complete: " + mappings.keySet());
     }
 
     /**
@@ -640,16 +628,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
             single = true;
 
-            for (Object o : keys) {
-                Object key0;
-
-                if (o instanceof KeyCacheObject)
-                    key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-                else
-                    key0 = o;
-
-                TestDebugLog.addEntryMessage(key0, null, "mapSingle0");
-            }
+            TestDebugLog.addEntryMessage(version(), null, "mapSingle0 " + primary.id());
 
             // Optimize mapping for single key.
             mapSingle(primary.id(), req);
@@ -766,6 +745,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
                         pendingMappings.put(nodeId, mapped);
 
+                        TestDebugLog.addEntryMessage(version(), null, "add mapping " + nodeId);
+
                         GridNearAtomicUpdateRequest old = mappings.put(nodeId, mapped);
 
                         assert old == null || (old != null && remap) :
@@ -784,16 +765,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
             single = true;
 
-            for (Object o : keys) {
-                Object key0;
-
-                if (o instanceof KeyCacheObject)
-                    key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-                else
-                    key0 = o;
-
-                TestDebugLog.addEntryMessage(key0, null, "mapSingle1");
-            }
+            TestDebugLog.addEntryMessage(version(), null, "mapSingle1");
 
             mapSingle(entry.getKey(), entry.getValue());
 
@@ -882,36 +854,20 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
                 locUpdate = req;
 
-                for (Object o : req.keys()) {
-                    Object key0;
-
-                    if (o instanceof KeyCacheObject)
-                        key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(), false);
-                    else
-                        key0 = o;
-
-                    TestDebugLog.addEntryMessage(key0, null, "localUpdate");
-                }
+                TestDebugLog.addEntryMessage(version(), null, "local update");
             }
             else {
                 try {
                     if (log.isDebugEnabled())
                         log.debug("Sending near atomic update request [nodeId=" + req.nodeId()
+ ", req=" + req + ']');
 
-                    for (Object o : req.keys()) {
-                        Object key0;
-
-                        if (o instanceof KeyCacheObject)
-                            key0 = ((KeyCacheObject) o).value(cctx.cacheObjectContext(),
false);
-                        else
-                            key0 = o;
-
-                        TestDebugLog.addEntryMessage(key0, null, "remoteUpdate");
-                    }
+                    TestDebugLog.addEntryMessage(version(), null, "remote update " + req.nodeId());
 
                     cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
                 }
                 catch (IgniteCheckedException e) {
+                    TestDebugLog.addEntryMessage(version(), null, "send failed " + req.nodeId());
+
                     addFailedKeys(req.keys(), e);
 
                     removeMapping(req.nodeId());
@@ -947,6 +903,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
      * @param nodeId Node ID to remove mapping for.
      */
     private void removeMapping(UUID nodeId) {
+        TestDebugLog.addEntryMessage(version(), null, "remove mapping " + nodeId);
+
         mappings.remove(nodeId);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36dca802/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index ffb1120..f84d5a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -309,66 +309,41 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends
GridCommonA
                 @Override public Object call() throws Exception {
                     Random rnd = new Random();
 
-                    try {
-                        while (!done.get()) {
-                            int cnt = rnd.nextInt(5);
-
-                            boolean put = cnt < 2;
-
-                            Map<Integer, Integer> upd = null;
-
-                            int key = 0;
-
-                            if (put) {
-                                key = rnd.nextInt(range);
-
-                                int val = rnd.nextInt();
-
-                                TestDebugLog.addEntryMessage(key, val, "put");
-
-                                cache.put(key, val);
-                            }
-                            else {
-                                upd = new TreeMap<>();
-
-                                for (int i = 0; i < cnt; i++) {
-                                    key = rnd.nextInt(range);
-                                    int val = rnd.nextInt();
+                    while (!done.get()) {
+                        try {
+                            Map<Integer, Integer> upd = new TreeMap<>();
 
-                                    upd.put(key, val);
+                            for (int i = 0; i < 100; i++)
+                                upd.put(rnd.nextInt(range), rnd.nextInt());
 
-                                    TestDebugLog.addEntryMessage(key, val, "putAll");
-                                }
+                            cache.putAll(upd);
+                        }
+                        catch (CachePartialUpdateException e) {
 
-                                cache.putAll(upd);
-                            }
                         }
-                    }
-                    catch (CachePartialUpdateException e) {
+                        catch (CacheAtomicUpdateTimeoutException e) {
+                            e.printStackTrace();
 
-                    }
-                    catch (CacheAtomicUpdateTimeoutException e) {
-                        e.printStackTrace();
+                            TestDebugLog.addMessage("atomic update timeout");
 
-                        TestDebugLog.addMessage("atomic update timeout");
+                            TestDebugLog.printMessages(false);
 
-                        TestDebugLog.printMessages(false);
+                            System.exit(22);
 
-                        System.exit(22);
+                        }
+                        catch (Exception e) {
+                            if (X.hasCause(e, CacheAtomicUpdateTimeoutCheckedException.class))
{
+                                e.printStackTrace();
 
-                    }
-                    catch (Exception e) {
-                        if (X.hasCause(e, CacheAtomicUpdateTimeoutCheckedException.class))
{
-                            e.printStackTrace();
+                                TestDebugLog.addMessage("atomic update timeout2");
 
-                            TestDebugLog.addMessage("atomic update timeout2");
+                                TestDebugLog.printMessages(false);
 
-                            TestDebugLog.printMessages(false);
+                                System.exit(22);
+                            }
 
-                            System.exit(22);
+                            throw e;
                         }
-
-                        throw e;
                     }
 
                     return null;
@@ -381,7 +356,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             for (int r = 0; r < 40 && !fut.isDone(); r++) {
                 int idx0 = rnd.nextInt(gridCnt - 1) + 1;
 
-                TestDebugLog.addMessage("stop grid " + idx0);
+                TestDebugLog.addMessage("stop grid " + ignite(idx0).cluster().localNode().id());
 
                 stopGrid(idx0);
 


Mime
View raw message