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 216CE173E5 for ; Thu, 18 Jun 2015 06:54:49 +0000 (UTC) Received: (qmail 19662 invoked by uid 500); 18 Jun 2015 06:54:49 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 19632 invoked by uid 500); 18 Jun 2015 06:54:49 -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 19623 invoked by uid 99); 18 Jun 2015 06:54:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 06:54:49 +0000 X-ASF-Spam-Status: No, hits=-2000.4 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 18 Jun 2015 06:52:30 +0000 Received: (qmail 17999 invoked by uid 99); 18 Jun 2015 06:54:09 -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; Thu, 18 Jun 2015 06:54:09 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3FE08E1801; Thu, 18 Jun 2015 06:54:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergi@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 18 Jun 2015 06:54:49 -0000 Message-Id: <4adc7474c7104829b60bf2adf15fcd51@git.apache.org> In-Reply-To: <89e53cb20a514306b8727a985f46f6c1@git.apache.org> References: <89e53cb20a514306b8727a985f46f6c1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [42/50] incubator-ignite git commit: ignite-484-1 - replicated cache group reservation fix + drop reservations group for dead nodes X-Virus-Checked: Checked by ClamAV on apache.org ignite-484-1 - replicated cache group reservation fix + drop reservations group for dead nodes Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1fe215e2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1fe215e2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1fe215e2 Branch: refs/heads/ignite-sprint-6 Commit: 1fe215e2cc83954f25cc7c2f0974dcf312694eb8 Parents: 68c35e7 Author: S.Vladykin Authored: Wed Jun 17 15:57:24 2015 +0300 Committer: S.Vladykin Committed: Wed Jun 17 15:57:24 2015 +0300 ---------------------------------------------------------------------- .../query/h2/twostep/GridMapQueryExecutor.java | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fe215e2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java index 42f01cb..aaf64ee 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java @@ -123,6 +123,18 @@ public class GridMapQueryExecutor { } }, EventType.EVT_NODE_FAILED, EventType.EVT_NODE_LEFT); + // Drop group reservations for dead caches. + ctx.event().addLocalEventListener(new GridLocalEventListener() { + @Override public void onEvent(Event evt) { + String cacheName = ((CacheEvent)evt).cacheName(); + + for (T2 grpKey : reservations.keySet()) { + if (F.eq(grpKey.get1(), cacheName)) + reservations.remove(grpKey); + } + } + }, EventType.EVT_CACHE_STOPPED); + ctx.io().addMessageListener(GridTopic.TOPIC_QUERY, new GridMessageListener() { @Override public void onMessage(UUID nodeId, Object msg) { if (!busyLock.enterBusy()) @@ -244,7 +256,9 @@ public class GridMapQueryExecutor { if (cctx.isLocal()) continue; - final T2 grpKey = new T2<>(cctx.name(), topVer); + // For replicated cache topology version does not make sense. + final T2 grpKey = + new T2<>(cctx.name(), cctx.isReplicated() ? null : topVer); GridReservable r = reservations.get(grpKey); @@ -265,10 +279,10 @@ public class GridMapQueryExecutor { // We don't need to reserve partitions because they will not be evicted in replicated caches. if (part == null || part.state() != OWNING) return false; - - // Mark that we checked this replicated cache. - reservations.putIfAbsent(grpKey, ReplicatedReservation.INSTANCE); } + + // Mark that we checked this replicated cache. + reservations.putIfAbsent(grpKey, ReplicatedReservation.INSTANCE); } } else { // Reserve primary partitions for partitioned cache (if no explicit given).