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 1694A184FA for ; Tue, 11 Aug 2015 07:27:35 +0000 (UTC) Received: (qmail 84245 invoked by uid 500); 11 Aug 2015 07:27:28 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 84212 invoked by uid 500); 11 Aug 2015 07:27:28 -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 84203 invoked by uid 99); 11 Aug 2015 07:27:28 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2015 07:27:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 5506F18193D for ; Tue, 11 Aug 2015 07:27:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.791 X-Spam-Level: * X-Spam-Status: No, score=1.791 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Kgf3jvyIvnFQ for ; Tue, 11 Aug 2015 07:27:13 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 168A52771C for ; Tue, 11 Aug 2015 07:27:11 +0000 (UTC) Received: (qmail 82833 invoked by uid 99); 11 Aug 2015 07:27:10 -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; Tue, 11 Aug 2015 07:27:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BF3F8E2F3C; Tue, 11 Aug 2015 07:27:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vkulichenko@apache.org To: commits@ignite.incubator.apache.org Date: Tue, 11 Aug 2015 07:27:13 -0000 Message-Id: <8897c828e919444184302fa03ec52dba@git.apache.org> In-Reply-To: <01fe7fc564c3447aa57a428396b623f3@git.apache.org> References: <01fe7fc564c3447aa57a428396b623f3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/50] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates IGNITE-104 - Ordered ATOMIC updates Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e5c69b83 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e5c69b83 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e5c69b83 Branch: refs/heads/ignite-426 Commit: e5c69b831a8f564440bd0960cc2a865cd907525a Parents: 424ab07 Author: Valentin Kulichenko Authored: Wed Jul 29 14:19:24 2015 -0700 Committer: Valentin Kulichenko Committed: Wed Jul 29 14:19:24 2015 -0700 ---------------------------------------------------------------------- .../dht/atomic/GridDhtAtomicCache.java | 9 ++++-- .../dht/atomic/GridDhtAtomicUpdateFuture.java | 33 +++++++++++++++----- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 7 ++++- 3 files changed, 37 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5c69b83/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 7a8cc06..02e48df 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 @@ -1178,6 +1178,9 @@ public class GridDhtAtomicCache extends GridDhtCacheAdapter { e.printStackTrace(); } finally { + if (dhtFut != null && !remap) + dhtFut.map(); + if (locked != null) unlockEntries(locked, req.topologyVersion()); @@ -1221,8 +1224,8 @@ public class GridDhtAtomicCache extends GridDhtCacheAdapter { else { // If there are backups, map backup update future. if (dhtFut != null) - dhtFut.map(); - // Otherwise, complete the call. + dhtFut.onMapped(); + // Otherwise, complete the call. else completionCb.apply(req, res); } @@ -2523,7 +2526,7 @@ public class GridDhtAtomicCache extends GridDhtCacheAdapter { } catch (ClusterTopologyCheckedException ignored) { U.warn(log, "Failed to send DHT atomic update response to node because it left grid: " + - req.nodeId()); + nodeId); } catch (IgniteCheckedException e) { U.error(log, "Failed to send DHT atomic update response (did node leave grid?) [nodeId=" + nodeId + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5c69b83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java index 3a68263..15ec121 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java @@ -90,6 +90,9 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter /** */ private boolean waitForExchange; + /** */ + private boolean mapped; + /** * @param cctx Cache context. * @param completionCb Callback to invoke when future is completed. @@ -349,37 +352,51 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter GridAtomicMappingKey mappingKey = e.getKey(); GridDhtAtomicUpdateRequest req = e.getValue(); + UUID nodeId = mappingKey.nodeId(); + int part = mappingKey.partition(); + + assert !nodeId.equals(cctx.localNodeId()); + try { if (log.isDebugEnabled()) - log.debug("Sending DHT atomic update request [nodeId=" + req.nodeId() + ", req=" + req + ']'); + log.debug("Sending DHT atomic update request [nodeId=" + nodeId + ", req=" + req + ']'); - if (mappingKey.partition() >= 0) { - Object topic = CU.partitionMessageTopic(cctx, mappingKey.partition(), false); + if (part >= 0) { + Object topic = CU.partitionMessageTopic(cctx, part, false); - cctx.io().sendOrderedMessage(mappingKey.nodeId(), topic, req, cctx.ioPolicy(), + cctx.io().sendOrderedMessage(nodeId, topic, req, cctx.ioPolicy(), 2 * cctx.gridConfig().getNetworkTimeout()); } else { - assert mappingKey.partition() == -1; + assert part == -1; - cctx.io().send(req.nodeId(), req, cctx.ioPolicy()); + cctx.io().send(nodeId, req, cctx.ioPolicy()); } } catch (ClusterTopologyCheckedException ignored) { U.warn(log, "Failed to send update request to backup node because it left grid: " + - req.nodeId()); + nodeId); mappings.remove(mappingKey); } catch (IgniteCheckedException ex) { U.error(log, "Failed to send update request to backup node (did node leave the grid?): " - + req.nodeId(), ex); + + nodeId, ex); mappings.remove(mappingKey); } } } + mapped = true; + } + + /** + * On mapped callback. + */ + public void onMapped() { + assert mapped; + checkComplete(); // Send response right away if no ACKs from backup is required. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e5c69b83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java index 35c6910..7149dec 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java @@ -44,7 +44,12 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid /** Message index. */ public static final int CACHE_MSG_IDX = nextIndexId(); - /** Node ID. */ + /** + * Node ID. + * + * @deprecated Not used anymore, but removal will break compatibility. + */ + @Deprecated private UUID nodeId; /** Future version. */