Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3D551200C3D for ; Tue, 14 Mar 2017 09:00:24 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3BFD3160B7E; Tue, 14 Mar 2017 08:00:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 66526160B9B for ; Tue, 14 Mar 2017 09:00:22 +0100 (CET) Received: (qmail 83630 invoked by uid 500); 14 Mar 2017 08:00:21 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 82949 invoked by uid 99); 14 Mar 2017 08:00:21 -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, 14 Mar 2017 08:00:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D250CF4B57; Tue, 14 Mar 2017 08:00:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Tue, 14 Mar 2017 08:00:32 -0000 Message-Id: <406c8f8984f841b2ae1537a1b4629384@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [13/38] ignite git commit: ignite-4768 archived-at: Tue, 14 Mar 2017 08:00:24 -0000 ignite-4768 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d3d4a36b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d3d4a36b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d3d4a36b Branch: refs/heads/ignite-4768 Commit: d3d4a36b4f0c71b5635dadd9211f73e728e29483 Parents: 784b171 Author: sboikov Authored: Thu Mar 9 16:38:54 2017 +0300 Committer: sboikov Committed: Thu Mar 9 16:38:54 2017 +0300 ---------------------------------------------------------------------- .../distributed/dht/GridDhtTxPrepareFuture.java | 85 +++++++++++--------- .../dht/GridDhtTxPrepareRequest.java | 12 +-- .../dht/GridDhtTxPrepareResponse.java | 20 ++--- 3 files changed, 64 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d3d4a36b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index d093b4a..735653d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -562,7 +562,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture dhtNodes = dht.topology().nodes(cached.partition(), tx.topologyVersion()); + assert dhtNodes.size() > 0 && dhtNodes.get(0).id().equals(cctx.localNodeId()) : dhtNodes; + if (log.isDebugEnabled()) log.debug("Mapping entry to DHT nodes [nodes=" + U.toShortString(dhtNodes) + ", entry=" + entry + ']'); - // Exclude local node. - map(entry, F.view(dhtNodes, F.remoteNodes(cctx.localNodeId())), dhtMap); + for (int i = 1; i < dhtNodes.size(); i++) { + ClusterNode node = dhtNodes.get(i); + + addMapping(entry, node, dhtMap); + } Collection readers = cached.readers(); if (!F.isEmpty(readers)) { - Collection nearNodes = - cctx.discovery().nodes(readers, F0.not(F.idForNodeId(tx.nearNodeId()))); + for (UUID readerId : readers) { + if (readerId.equals(tx.nearNodeId())) + continue; - if (log.isDebugEnabled()) - log.debug("Mapping entry to near nodes [nodes=" + U.toShortString(nearNodes) + - ", entry=" + entry + ']'); + ClusterNode readerNode = cctx.discovery().node(readerId); + + if (readerNode == null || dhtNodes.contains(readerNode)) + continue; + + if (log.isDebugEnabled()) + log.debug("Mapping entry to near node [node=" + readerNode + ", entry=" + entry + ']'); - // Exclude DHT nodes. - map(entry, F.view(nearNodes, F0.notIn(dhtNodes)), nearMap); + addMapping(entry, readerNode, nearMap); + } } else if (log.isDebugEnabled()) log.debug("Entry has no near readers: " + entry); @@ -1516,39 +1528,35 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture nodes, + ClusterNode n, Map globalMap ) { - if (nodes != null) { - for (ClusterNode n : nodes) { - GridDistributedTxMapping global = globalMap.get(n.id()); - - if (!F.isEmpty(entry.entryProcessors())) { - GridDhtPartitionState state = entry.context().topology().partitionState(n.id(), - entry.cached().partition()); + GridDistributedTxMapping global = globalMap.get(n.id()); - if (state != GridDhtPartitionState.OWNING && state != GridDhtPartitionState.EVICTED) { - T2 procVal = entry.entryProcessorCalculatedValue(); + if (!F.isEmpty(entry.entryProcessors())) { + GridDhtPartitionState state = entry.context().topology().partitionState(n.id(), + entry.cached().partition()); - assert procVal != null : entry; + if (state != GridDhtPartitionState.OWNING && state != GridDhtPartitionState.EVICTED) { + T2 procVal = entry.entryProcessorCalculatedValue(); - entry.op(procVal.get1()); - entry.value(procVal.get2(), true, false); - entry.entryProcessors(null); - } - } + assert procVal != null : entry; - if (global == null) - globalMap.put(n.id(), global = new GridDistributedTxMapping(n)); - - global.add(entry); + entry.op(procVal.get1()); + entry.value(procVal.get2(), true, false); + entry.entryProcessors(null); } } + + if (global == null) + globalMap.put(n.id(), global = new GridDistributedTxMapping(n)); + + global.add(entry); } /** @@ -1602,7 +1610,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture nearEvicted() { + Collection nearEvicted() { return nearEvicted; } @@ -133,14 +133,14 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse { /** * @return Mini future ID. */ - public IgniteUuid miniId() { + public int miniId() { return miniId; } /** * @return Map from cacheId to an array of invalid partitions. */ - public Map invalidPartitionsByCacheId() { + Map invalidPartitionsByCacheId() { return invalidParts; } @@ -250,7 +250,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse { writer.incrementState(); case 10: - if (!writer.writeIgniteUuid("miniId", miniId)) + if (!writer.writeInt("miniId", miniId)) return false; writer.incrementState(); @@ -300,7 +300,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse { reader.incrementState(); case 10: - miniId = reader.readIgniteUuid("miniId"); + miniId = reader.readInt("miniId"); if (!reader.isLastRead()) return false;