You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/08/10 13:04:02 UTC

[03/12] incubator-ignite git commit: ignite-1189: reproducing deadlock

ignite-1189: reproducing deadlock


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

Branch: refs/heads/ignite-gg-9615
Commit: efa7e99bbad76ce35a55e6ad9faa9aac8e57b5f4
Parents: 6b237e1
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Aug 4 09:12:12 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Aug 4 09:12:12 2015 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 36 +++++++++++++++-
 .../IgniteCacheAtomicNodeRestartTest.java       | 43 ++++++++++++++++++++
 2 files changed, 78 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa7e99b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 0a21979..18911fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -85,6 +85,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /** */
     private GridNearAtomicCache<K, V> near;
 
+    private ThreadLocal<List<GridDhtCacheEntry>> lockedEntries = new ThreadLocal<>();
+
     /**
      * Empty constructor required by {@link Externalizable}.
      */
@@ -990,6 +992,20 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         final GridNearAtomicUpdateRequest req,
         final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
     ) {
+        boolean printKeys = false;
+
+        if (lockedEntries.get() != null) {
+            for (GridDhtCacheEntry entry : lockedEntries.get())
+                U.error(log, "Locked entry [entry=" + entry + ']');
+
+            printKeys = true;
+        }
+
+        if (printKeys) {
+            for (KeyCacheObject obj : req.keys())
+                U.error(log, "Key requested: " + obj);
+        }
+
         IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
 
         if (forceFut.isDone())
@@ -1032,10 +1048,26 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         IgniteCacheExpiryPolicy expiry = null;
 
         try {
+            boolean printKeys = false;
+
+            if (lockedEntries.get() != null) {
+                for (GridDhtCacheEntry entry : lockedEntries.get())
+                    U.error(log, "Locked entry (2) [entry=" + entry + ']');
+
+                printKeys = true;
+            }
+
+            if (printKeys) {
+                for (KeyCacheObject obj : keys)
+                    U.error(log, "Key requested: " + obj);
+            }
+
             // If batch store update is enabled, we need to lock all entries.
             // First, need to acquire locks on cache entries, then check filter.
             List<GridDhtCacheEntry> locked = lockEntries(keys, req.topologyVersion());
 
+            lockedEntries.set(locked);
+
             Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null;
 
             try {
@@ -1153,8 +1185,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                 e.printStackTrace();
             }
             finally {
-                if (locked != null)
+                if (locked != null) {
+                    lockedEntries.set(null);
                     unlockEntries(locked, req.topologyVersion());
+                }
 
                 // Enqueue if necessary after locks release.
                 if (deleted != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa7e99b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
index fa8898f..70e6c4c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeRestartTest.java
@@ -31,7 +31,50 @@ public class IgniteCacheAtomicNodeRestartTest extends GridCachePartitionedNodeRe
         return ATOMIC;
     }
 
+    /** {@inheritDoc} */
     @Override public void testRestartWithPutTenNodesTwoBackups() throws Throwable {
+        super.testRestartWithPutTenNodesTwoBackups();
+    }
+
+    @Override public void testRestart() throws Exception {
+    }
+
+    @Override public void testRestartWithPutTwoNodesNoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithPutTwoNodesOneBackup() throws Throwable {
+    }
+
+    @Override public void testRestartWithPutFourNodesNoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithPutFourNodesOneBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithPutSixNodesTwoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithPutEightNodesTwoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithTxEightNodesTwoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithTxFourNodesNoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithTxFourNodesOneBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithTxSixNodesTwoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithTxTenNodesTwoBackups() throws Throwable {
+    }
+
+    @Override public void testRestartWithTxTwoNodesNoBackups() throws Throwable {
+    }
 
+    @Override public void testRestartWithTxTwoNodesOneBackup() throws Throwable {
     }
 }