ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/3] ignite git commit: debug info
Date Wed, 03 May 2017 15:47:48 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-gg-8.0.3.ea6-clients-test 036caac3f -> 881e77d97


debug info


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

Branch: refs/heads/ignite-gg-8.0.3.ea6-clients-test
Commit: 3efa39a59992c3f6557c55b7009face674e600aa
Parents: 54668f1
Author: sboikov <sboikov@gridgain.com>
Authored: Wed May 3 16:19:59 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed May 3 18:41:03 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/IgniteDiagnosticAware.java  | 25 +++++++++
 .../internal/IgniteDiagnosticMessage.java       | 58 +++++++++++++++++++-
 .../GridCachePartitionExchangeManager.java      | 28 ++++++++--
 .../dht/GridPartitionedSingleGetFuture.java     | 23 +++++++-
 .../colocated/GridDhtColocatedLockFuture.java   | 50 ++++++++++++++++-
 .../GridDhtPartitionsAbstractMessage.java       |  4 ++
 .../processors/cluster/ClusterProcessor.java    | 38 +++++++++++--
 .../communication/tcp/TcpCommunicationSpi.java  | 40 ++------------
 8 files changed, 218 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
new file mode 100644
index 0000000..f33f678
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+/**
+ *
+ */
+public interface IgniteDiagnosticAware {
+    public void dumpDiagnosticInfo();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
index 7783b81..0e8e337 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
@@ -18,9 +18,13 @@
 package org.apache.ignite.internal;
 
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -31,6 +35,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import java.nio.ByteBuffer;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.Collection;
 import java.util.Date;
 import java.util.UUID;
 
@@ -39,6 +44,9 @@ import java.util.UUID;
  */
 public class IgniteDiagnosticMessage implements Message {
     /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
     private static final ThreadLocal<DateFormat> dateFormat = new ThreadLocal<DateFormat>()
{
         @Override protected DateFormat initialValue() {
             return new SimpleDateFormat("HH:mm:ss.SSS");
@@ -175,7 +183,11 @@ public class IgniteDiagnosticMessage implements Message {
     }
 
     @Override public void onAckReceived() {
+        // No-op.
+    }
 
+    @Override public String toString() {
+        return S.toString(IgniteDiagnosticMessage.class, this);
     }
 
     /**
@@ -192,7 +204,7 @@ public class IgniteDiagnosticMessage implements Message {
             this.nodeId = ctx.localNodeId();
         }
 
-        @Override public String apply(GridKernalContext ctx) {
+        @Override public final String apply(GridKernalContext ctx) {
             try {
                 StringBuilder sb = new StringBuilder();
 
@@ -223,6 +235,50 @@ public class IgniteDiagnosticMessage implements Message {
         }
     }
 
+    public static class TxEntriesInfoClosure extends BaseClosure {
+        /** */
+        private final int cacheId;
+
+        /** */
+        private final Collection<KeyCacheObject> keys;
+
+        public TxEntriesInfoClosure(GridKernalContext ctx, int cacheId, Collection<KeyCacheObject>
keys) {
+            super(ctx);
+
+            this.cacheId = cacheId;
+            this.keys = keys;
+        }
+
+        @Override protected String dumpInfo(GridKernalContext ctx) {
+            GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
+
+            if (cctx == null)
+                return "Failed to find cache with id: " + cacheId;
+
+            try {
+                for (KeyCacheObject key : keys)
+                    key.finishUnmarshal(cctx.cacheObjectContext(), null);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.cluster().diagnosticLog().error("Failed to unmarshal key: " + e, e);
+
+                return "Failed to unmarshal key: " + e;
+            }
+
+            StringBuilder sb = new StringBuilder("Cache entries [cacheId=" + cacheId + ",
cacheName=" + cctx.name() + "]: ");
+
+            for (KeyCacheObject key : keys) {
+                sb.append(U.nl());
+
+                GridCacheMapEntry e = (GridCacheMapEntry)cctx.cache().peekEx(key);
+
+                sb.append("Key [key=" + key + ", entry=" + e + "]");
+            }
+
+            return sb.toString();
+        }
+    }
+
     public static String dumpNodeBasicInfo(GridKernalContext ctx) {
         StringBuilder sb = new StringBuilder("General node info [id=").append(ctx.localNodeId());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 95cb452..3f9fb2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -49,13 +49,13 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.events.DiscoveryCustomEvent;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
-import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.pagemem.snapshot.StartSnapshotOperationAckDiscoveryMessage;
 import org.apache.ignite.internal.managers.discovery.DiscoCache;
 import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener;
@@ -1460,6 +1460,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                         if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD)
{
                             U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime())
+
                                 ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+
+                            if (fut instanceof IgniteDiagnosticAware)
+                                ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
                         }
                         else
                             break;
@@ -1473,6 +1476,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                         if (longRunningOpsDumpCnt < GridDhtPartitionsExchangeFuture.DUMP_PENDING_OBJECTS_THRESHOLD)
{
                             U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime())
+
                                 ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+
+                            if (fut instanceof IgniteDiagnosticAware)
+                                ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
                         }
                         else
                             break;
@@ -1542,14 +1548,22 @@ public class GridCachePartitionExchangeManager<K, V> extends
GridCacheSharedMana
 
             U.warn(log, "Pending cache futures:");
 
-            for (GridCacheFuture<?> fut : mvcc.activeFutures())
+            for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
                 U.warn(log, ">>> " + fut);
 
+                if (fut instanceof IgniteDiagnosticAware)
+                    ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
+            }
+
             U.warn(log, "Pending atomic cache futures:");
 
-            for (GridCacheFuture<?> fut : mvcc.atomicFutures())
+            for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
                 U.warn(log, ">>> " + fut);
 
+                if (fut instanceof IgniteDiagnosticAware)
+                    ((IgniteDiagnosticAware)fut).dumpDiagnosticInfo();
+            }
+
             U.warn(log, "Pending data streamer futures:");
 
             for (IgniteInternalFuture<?> fut : mvcc.dataStreamerFutures())
@@ -1978,8 +1992,14 @@ public class GridCachePartitionExchangeManager<K, V> extends
GridCacheSharedMana
             GridDhtPartitionsExchangeFuture fut) {
             GridDhtPartitionsExchangeFuture cur = super.addx(fut);
 
-            while (size() > EXCHANGE_HISTORY_SIZE)
+            while (size() > EXCHANGE_HISTORY_SIZE) {
+                GridDhtPartitionsExchangeFuture last = last();
+
+                if (last != null && !last.isDone())
+                    break;
+
                 removeLast();
+            }
 
             // Return the value in the set.
             return cur == null ? fut : cur;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index 6e438ed..398c99d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -64,7 +65,7 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
  *
  */
 public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object> implements
GridCacheFuture<Object>,
-    CacheGetFuture {
+    CacheGetFuture, IgniteDiagnosticAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -760,6 +761,26 @@ public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object>
im
     }
 
     /** {@inheritDoc} */
+    @Override public void dumpDiagnosticInfo() {
+        if (!isDone()) {
+            UUID nodeId;
+            AffinityTopologyVersion topVer;
+
+            synchronized (this) {
+                nodeId = node != null ? node.id() : null;
+                topVer = this.topVer;
+            }
+
+            if (nodeId != null)
+                cctx.kernalContext().cluster().dumpBasicInfo(nodeId, "GridPartitionedSingleGetFuture
waiting for " +
+                    "response [node=" + nodeId +
+                    ", key=" + key +
+                    ", futId=" + futId +
+                    ", topVer=" + topVer + ']');
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridPartitionedSingleGetFuture.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index a1847d2..519f05d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -84,7 +85,7 @@ import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ;
  * Colocated cache lock future.
  */
 public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture<Boolean>
-    implements GridCacheMvccFuture<Boolean> {
+    implements GridCacheMvccFuture<Boolean>, IgniteDiagnosticAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -589,13 +590,52 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
     }
 
     /** {@inheritDoc} */
+    @Override public void dumpDiagnosticInfo() {
+        if (!isDone()) {
+            for (IgniteInternalFuture fut : futures()) {
+                if (!fut.isDone() && isMini(fut)) {
+                    MiniFuture m = (MiniFuture)fut;
+
+                    AffinityTopologyVersion topVer = null;
+                    UUID rmtNodeId = null;
+
+                    synchronized (m) {
+                        if (!m.rcvRes && !m.node.isLocal()) {
+                            rmtNodeId = m.node.id();
+
+                            topVer = this.topVer;
+                        }
+                    }
+
+                    if (rmtNodeId != null) {
+                        cctx.kernalContext().cluster().dumpTxKeyInfo(rmtNodeId, cctx.cacheId(),
m.keys,
+                            "GridDhtColocatedLockFuture waiting for response [node=" + rmtNodeId
+
+                            ", cache=" + cctx.name() +
+                            ", miniId=" + m.futId +
+                            ", topVer=" + topVer +
+                            ", keys=" + m.keys + ']');
+
+                        return;
+                    }
+                }
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>,
String>() {
             @Override public String apply(IgniteInternalFuture<?> f) {
                 if (isMini(f)) {
                     MiniFuture m = (MiniFuture)f;
 
-                    return "[node=" + m.node().id() + ", loc=" + m.node().isLocal() + ",
done=" + f.isDone() + "]";
+                    synchronized (m) {
+                        return "[node=" + m.node().id() +
+                            ", rcvRes=" + m.rcvRes +
+                            ", remapVer=" + m.remapTopVer +
+                            ", loc=" + m.node().isLocal() +
+                            ", done=" + f.isDone() + "]";
+                    }
                 }
                 else
                     return "[loc=true, done=" + f.isDone() + "]";
@@ -603,6 +643,7 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
         });
 
         return S.toString(GridDhtColocatedLockFuture.class, this,
+            "topVer", topVer,
             "innerFuts", futs,
             "inTx", inTx(),
             "super", super.toString());
@@ -1404,6 +1445,9 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
         /** */
         private boolean rcvRes;
 
+        /** Remap topology version for debug purpose. */
+        private AffinityTopologyVersion remapTopVer;
+
         /**
          * @param node Node.
          * @param keys Keys.
@@ -1475,6 +1519,8 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
                     return;
 
                 rcvRes = true;
+
+                remapTopVer = res.clientRemapVersion();
             }
 
             if (res.error() != null) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
index f1e2c01..48ae228 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
@@ -67,6 +67,10 @@ public abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage
         this.lastVer = lastVer;
     }
 
+    @Override public int partition() {
+        return Integer.MIN_VALUE;
+    }
+
     /** {@inheritDoc} */
     @Override public boolean addDeploymentInfo() {
         return false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
index 0d0aead..813b039 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cluster;
 
 import java.io.Serializable;
 import java.lang.ref.WeakReference;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Timer;
@@ -45,6 +46,7 @@ import org.apache.ignite.internal.managers.communication.GridIoPolicy;
 import org.apache.ignite.internal.managers.communication.GridMessageListener;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.util.GridTimerTask;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -66,7 +68,7 @@ import static org.apache.ignite.internal.IgniteVersionUtils.VER_STR;
  */
 public class ClusterProcessor extends GridProcessorAdapter {
     /** */
-    public static final String DIAGNOSTIC_LOG_CATEGORY = "org.apache.ignite.internal.diagnostic";
+    private static final String DIAGNOSTIC_LOG_CATEGORY = "org.apache.ignite.internal.diagnostic";
 
     /** */
     private static final String ATTR_UPDATE_NOTIFIER_STATUS = "UPDATE_NOTIFIER_STATUS";
@@ -100,6 +102,9 @@ public class ClusterProcessor extends GridProcessorAdapter {
     /** */
     private final AtomicLong diagFutId = new AtomicLong();
 
+    /** */
+    private final Object mux = new Object();
+
     /**
      * @param ctx Kernal context.
      */
@@ -285,9 +290,34 @@ public class ClusterProcessor extends GridProcessorAdapter {
         return verChecker != null ? verChecker.latestVersion() : null;
     }
 
-    public IgniteInternalFuture<String> diagnosticInfo(final UUID nodeId,
+    public void dumpTxKeyInfo(UUID nodeId, int cacheId, Collection<KeyCacheObject>
keys, final String msg) {
+        IgniteInternalFuture<String> fut = diagnosticInfo(nodeId, new IgniteDiagnosticMessage.TxEntriesInfoClosure(ctx,
cacheId, keys), msg);
+
+        listenAndLog(fut);
+    }
+
+    public void dumpBasicInfo(final UUID nodeId, final String msg) {
+        IgniteInternalFuture<String> fut = diagnosticInfo(nodeId, new IgniteDiagnosticMessage.BaseClosure(ctx),
msg);
+
+        listenAndLog(fut);
+    }
+
+    private void listenAndLog(IgniteInternalFuture<String> fut) {
+        fut.listen(new CI1<IgniteInternalFuture<String>>() {
+            @Override public void apply(IgniteInternalFuture<String> msgFut) {
+                try {
+                    diagnosticLog.info(msgFut.get());
+                }
+                catch (Exception e) {
+                    diagnosticLog.error("Failed to dump diagnostic info: " + e);
+                }
+            }
+        });
+    }
+
+    private IgniteInternalFuture<String> diagnosticInfo(final UUID nodeId,
         IgniteClosure<GridKernalContext, String> c,
-        final String msg) {
+        final String baseMsg) {
         final GridFutureAdapter<String> infoFut = new GridFutureAdapter<>();
 
         final IgniteInternalFuture<String> rmtFut = sendDiagnosticMessage(nodeId, c);
@@ -318,7 +348,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
                             locMsg = "Failed to get info for local node: " + e;
                         }
 
-                        StringBuilder sb = new StringBuilder(msg);
+                        StringBuilder sb = new StringBuilder(baseMsg);
 
                         sb.append(U.nl());
                         sb.append("Remote node information:").append(U.nl()).append(rmtMsg0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3efa39a5/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 650d25b..2d4bdf9 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -1813,43 +1813,11 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         }
 
         if (connectionsPerNode > 1) {
-            int idxMode = IgniteSystemProperties.getInteger("CONN_IDX_MODE", 0);
-
-            switch (idxMode) {
-                case 0: {
-                    connPlc = new ConnectionPolicy() {
-                        @Override public int connectionIndex() {
-                            return (int)(Thread.currentThread().getId() % connectionsPerNode);
-                        }
-                    };
-
-                    break;
-                }
-
-                case 1: {
-                    connPlc = new ConnectionPolicy() {
-                        @Override public int connectionIndex() {
-                            Integer threadIdx = threadConnIdx.get();
-
-                            if (threadIdx != null)
-                                return threadIdx;
-
-                            for (;;) {
-                                int idx = connIdx.get();
-                                int nextIdx = idx == connectionsPerNode - 1 ? 0 : idx + 1;
-
-                                if (connIdx.compareAndSet(idx, nextIdx)) {
-                                    threadConnIdx.set(idx);
-
-                                    return idx;
-                                }
-                            }
-                        }
-                    };
-
-                    break;
+            connPlc = new ConnectionPolicy() {
+                @Override public int connectionIndex() {
+                    return (int)(U.safeAbs(Thread.currentThread().getId()) % connectionsPerNode);
                 }
-            }
+            };
         }
         else {
             connPlc = new ConnectionPolicy() {


Mime
View raw message