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 2016/08/24 14:04:49 UTC

[26/50] [abbrv] ignite git commit: Print debug information on 'waitForRent' timeout.

Print debug information on 'waitForRent' timeout.


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

Branch: refs/heads/ignite-2649
Commit: 7cf26d9601f25b96198172f1c8140a0a34687814
Parents: a39770a
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jul 26 15:48:36 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jul 26 15:48:36 2016 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  |  2 +-
 .../dht/GridDhtPartitionTopologyImpl.java       | 36 +++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7cf26d96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 2c33fa2..6ea6159 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -507,7 +507,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     /**
      * @return {@code true} If there is a group reservation.
      */
-    private boolean groupReserved() {
+    public boolean groupReserved() {
         for (GridDhtPartitionsReservation reservation : reservations) {
             if (!reservation.invalidate())
                 return true; // Failed to invalidate reservation -> we are reserved.

http://git-wip-us.apache.org/repos/asf/ignite/blob/7cf26d96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 501388c..f9344bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -32,8 +32,10 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -51,6 +53,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT;
 import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.EVICTED;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
@@ -171,6 +174,11 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     private boolean waitForRent() throws IgniteCheckedException {
         boolean changed = false;
 
+        final long longOpDumpTimeout =
+            IgniteSystemProperties.getLong(IgniteSystemProperties.IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, 60_000);
+
+        int dumpCnt = 0;
+
         // Synchronously wait for all renting partitions to complete.
         for (Iterator<GridDhtLocalPartition> it = locParts.values().iterator(); it.hasNext();) {
             GridDhtLocalPartition p = it.next();
@@ -182,7 +190,33 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                     log.debug("Waiting for renting partition: " + p);
 
                 // Wait for partition to empty out.
-                p.rent(true).get();
+                if (longOpDumpTimeout > 0) {
+                    while (true) {
+                        try {
+                            p.rent(true).get(longOpDumpTimeout);
+
+                            break;
+                        }
+                        catch (IgniteFutureTimeoutCheckedException e) {
+                            if (dumpCnt++ < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD) {
+                                U.warn(log, "Failed to wait for partition eviction [" +
+                                    "topVer=" + topVer +
+                                    ", cache=" + cctx.name() +
+                                    ", part=" + p.id() +
+                                    ", partState=" + p.state() +
+                                    ", size=" + p.size() +
+                                    ", reservations=" + p.reservations() +
+                                    ", grpReservations=" + p.groupReserved() +
+                                    ", node=" + cctx.localNodeId() + "]");
+
+                                if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
+                                    U.dumpThreads(log);
+                            }
+                        }
+                    }
+                }
+                else
+                    p.rent(true).get();
 
                 if (log.isDebugEnabled())
                     log.debug("Finished waiting for renting partition: " + p);