ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [10/50] [abbrv] incubator-ignite git commit: ignite-646
Date Fri, 08 May 2015 09:21:13 GMT
ignite-646


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

Branch: refs/heads/ignite-gg-10186
Commit: db7aa241ac522c9b9720d3c9bd4198fb66b94df2
Parents: 9e4bc10
Author: avinogradov <avinogradov@gridgain.com>
Authored: Fri Apr 24 19:38:04 2015 +0300
Committer: avinogradov <avinogradov@gridgain.com>
Committed: Fri Apr 24 19:38:04 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheIoManager.java    | 15 ++++
 .../IgniteCacheP2pUnmarshallingErrorTxTest.java | 72 ++++++++------------
 2 files changed, 42 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db7aa241/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 1fe1f50..c9af788 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -315,6 +315,21 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter
{
         GridCacheContext ctx = cctx.cacheContext(msg.cacheId());
 
         switch (msg.directType()) {
+            case 30: {
+                GridDhtLockRequest req = (GridDhtLockRequest)msg;
+
+                GridDhtLockResponse res = new GridDhtLockResponse(
+                    ctx.cacheId(),
+                    req.version(),
+                    req.futureId(),
+                    req.miniId(),
+                    0);
+
+                sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+            }
+
+            break;
+
             case 34:{
                 GridDhtTxPrepareRequest req = (GridDhtTxPrepareRequest)msg;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db7aa241/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTxTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTxTest.java
index 1a42407..06176aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTxTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.transactions.*;
 
+import javax.cache.*;
 import java.io.*;
 
 /**
@@ -35,8 +36,14 @@ public class IgniteCacheP2pUnmarshallingErrorTxTest extends IgniteCacheP2pUnmars
         return CacheAtomicityMode.TRANSACTIONAL;
     }
 
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (!gridName.endsWith("0"))
+            cfg.getCacheConfiguration()[0].setRebalanceDelay(-1); //allows to check GridDhtLockRequest
fail.
+
+        return cfg;
     }
 
     /**
@@ -68,28 +75,9 @@ public class IgniteCacheP2pUnmarshallingErrorTxTest extends IgniteCacheP2pUnmars
 
             assert false : "p2p marshalling failed, but error response was not sent";
         }
-//        catch (IgniteException e) {
-//            assert X.hasCause(e, IOException.class);
-//        }
-
-        assert readCnt.get() == 0; //ensure we have read count as expected.
-    }
-
-    /**
-     * Sends put with pessimistic lock and handles fail.
-     */
-    protected void failPessimicticOnCommit() {
-        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
-
-            jcache(0).put(new TestKey(String.valueOf(++key)), "");
-
-            tx.commit();
-
-            assert false : "p2p marshalling failed, but error response was not sent";
+        catch (CacheException e) {
+            assert X.hasCause(e, IOException.class);
         }
-//        catch (IgniteException e) {
-//            assert X.hasCause(e, IOException.class);
-//        }
 
         assert readCnt.get() == 0; //ensure we have read count as expected.
     }
@@ -98,32 +86,26 @@ public class IgniteCacheP2pUnmarshallingErrorTxTest extends IgniteCacheP2pUnmars
      * Tests that correct response will be sent to client node in case of unmarshalling failed.
      */
     public void testResponseMessageOnUnmarshallingFailed() {
-//        //GridNearTxPrepareRequest unmarshalling failed test
-//        readCnt.set(2);
-//
-//        failOptimistic();
-//
-//        //GridDhtTxPrepareRequest unmarshalling failed test
-//        readCnt.set(3);
-//
-//        failOptimistic();
-
-//        //GridNearLockRequest unmarshalling failed test
-//        readCnt.set(2);
-//
-//        failPessimictic();
-
-        //? unmarshalling failed test
-        readCnt.set(1000);
-        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
+        //GridNearTxPrepareRequest unmarshalling failed test
+        readCnt.set(2);
 
-            TestKey tstKey = new TestKey(String.valueOf(++key));
-            jcache(0).put(tstKey, "");
-            jcache(0).lock(tstKey).lock();
-        }
+        failOptimistic();
+
+        //GridDhtTxPrepareRequest unmarshalling failed test
+        readCnt.set(3);
 
+        failOptimistic();
 
+        //GridNearLockRequest unmarshalling failed test
+        readCnt.set(2);
 
+        failPessimictic();
 
+        //GridDhtLockRequest unmarshalling failed test
+        readCnt.set(3);
+
+        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
+            jcache(0).put(new TestKey(String.valueOf(++key)), ""); //No failure at client
side.
+        }
     }
 }


Mime
View raw message