Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0364F18CDC for ; Fri, 24 Jul 2015 16:50:51 +0000 (UTC) Received: (qmail 6803 invoked by uid 500); 24 Jul 2015 16:50:48 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 6771 invoked by uid 500); 24 Jul 2015 16:50:48 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 6744 invoked by uid 99); 24 Jul 2015 16:50:48 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 16:50:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C249CC0252 for ; Fri, 24 Jul 2015 16:50:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id b_ykECvCcA73 for ; Fri, 24 Jul 2015 16:50:39 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 348C947BE8 for ; Fri, 24 Jul 2015 16:50:39 +0000 (UTC) Received: (qmail 6662 invoked by uid 99); 24 Jul 2015 16:50:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 16:50:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 86BC0E0544; Fri, 24 Jul 2015 16:50:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yzhdanov@apache.org To: commits@ignite.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: added turbo debug mode to communication Date: Fri, 24 Jul 2015 16:50:38 +0000 (UTC) Repository: incubator-ignite Updated Branches: refs/heads/ignite-1.3.3 32f84c121 -> 6f48d4a97 added turbo debug mode to communication Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6f48d4a9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6f48d4a9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6f48d4a9 Branch: refs/heads/ignite-1.3.3 Commit: 6f48d4a978036f571ca37a5388d9da6449f01114 Parents: 32f84c1 Author: Yakov Zhdanov Authored: Fri Jul 24 19:50:28 2015 +0300 Committer: Yakov Zhdanov Committed: Fri Jul 24 19:50:28 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/internal/IgnitionEx.java | 26 ++++++ .../managers/communication/GridIoManager.java | 84 +++++++++++++++++++- .../src/test/config/io-manager-benchmark.xml | 3 +- 3 files changed, 110 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6f48d4a9/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java index 5cbe377..73de99a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java @@ -1087,6 +1087,32 @@ public class IgnitionEx { } /** + * Gets grid instance without waiting its initialization and not throwing any exception. + * + * @param locNodeId ID of local node the requested grid instance is managing. + * @return Grid instance or {@code null}. + */ + public static IgniteKernal gridxx(UUID locNodeId) { + IgniteNamedInstance dfltGrid0 = dfltGrid; + + if (dfltGrid0 != null) { + IgniteKernal g = dfltGrid0.grid(); + + if (g != null && g.getLocalNodeId().equals(locNodeId)) + return g; + } + + for (IgniteNamedInstance grid : grids.values()) { + IgniteKernal g = grid.grid(); + + if (g != null && g.getLocalNodeId().equals(locNodeId)) + return g; + } + + return null; + } + + /** * Gets an named grid instance. If grid name is {@code null} or empty string, * then default no-name grid will be returned. Note that caller of this method * should not assume that it will return the same instance every time. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6f48d4a9/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index c1fb79a..65b6fad 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -57,6 +57,9 @@ import static org.jsr166.ConcurrentLinkedHashMap.QueuePolicy.*; * Grid communication manager. */ public class GridIoManager extends GridManagerAdapter> { + /** */ + public static volatile boolean TURBO_DEBUG_MODE; + /** Empty array of message factories. */ public static final MessageFactory[] EMPTY = {}; @@ -894,7 +897,7 @@ public class GridIoManager extends GridManagerAdapter + * This method eliminates network between nodes started in single JVM + * when {@link #TURBO_DEBUG_MODE} is set to {@code true}. + *

+ * How to use it: + *

    + *
  1. Replace {@link #send(ClusterNode, Object, int, Message, byte, boolean, long, boolean)} + * with this method.
  2. + *
  3. Start all grids for your test, then set {@link #TURBO_DEBUG_MODE} to {@code true}.
  4. + *
  5. Perform test operations on the topology. No network will be there.
  6. + *
  7. DO NOT turn on turbo debug before all grids started. This will cause deadlocks.
  8. + *
+ * + * @param node Destination node. + * @param topic Topic to send the message to. + * @param topicOrd GridTopic enumeration ordinal. + * @param msg Message to send. + * @param plc Type of processing. + * @param ordered Ordered flag. + * @param timeout Timeout. + * @param skipOnTimeout Whether message can be skipped on timeout. + * @throws IgniteCheckedException Thrown in case of any errors. + */ + private void sendTurboDebug( + ClusterNode node, + Object topic, + int topicOrd, + Message msg, + byte plc, + boolean ordered, + long timeout, + boolean skipOnTimeout + ) throws IgniteCheckedException { + assert node != null; + assert topic != null; + assert msg != null; + + GridIoMessage ioMsg = new GridIoMessage(plc, topic, topicOrd, msg, ordered, timeout, skipOnTimeout); + + IgniteKernal rmt; + + if (locNodeId.equals(node.id())) { + assert plc != P2P_POOL; + + CommunicationListener commLsnr = this.commLsnr; + + if (commLsnr == null) + throw new IgniteCheckedException("Trying to send message when grid is not fully started."); + + if (ordered) + processOrderedMessage(locNodeId, ioMsg, plc, null); + else + processRegularMessage0(ioMsg, locNodeId); + } + else if (TURBO_DEBUG_MODE && (rmt = IgnitionEx.gridxx(locNodeId)) != null) { + if (ioMsg.isOrdered()) + rmt.context().io().processOrderedMessage(locNodeId, ioMsg, ioMsg.policy(), null); + else + rmt.context().io().processRegularMessage0(ioMsg, locNodeId); + } + else { + if (topicOrd < 0) + ioMsg.topicBytes(marsh.marshal(topic)); + + try { + getSpi().sendMessage(node, ioMsg); + } + catch (IgniteSpiException e) { + throw new IgniteCheckedException("Failed to send message (node may have left the grid or " + + "TCP connection cannot be established due to firewall issues) " + + "[node=" + node + ", topic=" + topic + + ", msg=" + msg + ", policy=" + plc + ']', e); + } + } + } + + /** * @param nodeId Id of destination node. * @param topic Topic to send the message to. * @param msg Message to send. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6f48d4a9/modules/core/src/test/config/io-manager-benchmark.xml ---------------------------------------------------------------------- diff --git a/modules/core/src/test/config/io-manager-benchmark.xml b/modules/core/src/test/config/io-manager-benchmark.xml index 9b97407..4f481ec 100644 --- a/modules/core/src/test/config/io-manager-benchmark.xml +++ b/modules/core/src/test/config/io-manager-benchmark.xml @@ -27,8 +27,7 @@ - - +