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 D6ED5200BEB for ; Wed, 28 Dec 2016 15:04:29 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D59CD160B47; Wed, 28 Dec 2016 14:04:29 +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 72490160B4D for ; Wed, 28 Dec 2016 15:04:28 +0100 (CET) Received: (qmail 74334 invoked by uid 500); 28 Dec 2016 14:04:27 -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 73916 invoked by uid 99); 28 Dec 2016 14:04:27 -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; Wed, 28 Dec 2016 14:04:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6464BF3519; Wed, 28 Dec 2016 14:04:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yzhdanov@apache.org To: commits@ignite.apache.org Date: Wed, 28 Dec 2016 14:04:44 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/50] [abbrv] ignite git commit: ignite-4450 Need release locks for failing nodes during exchange processing. archived-at: Wed, 28 Dec 2016 14:04:30 -0000 ignite-4450 Need release locks for failing nodes during exchange processing. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/41dddb87 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/41dddb87 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/41dddb87 Branch: refs/heads/ignite-comm-balance-master Commit: 41dddb87da53bbe72594b0b4bb9e2a396a57b986 Parents: c864fe4 Author: sboikov Authored: Thu Dec 22 11:26:18 2016 +0300 Committer: sboikov Committed: Thu Dec 22 11:26:18 2016 +0300 ---------------------------------------------------------------------- .../GridDhtPartitionsExchangeFuture.java | 6 +- .../CacheLockReleaseNodeLeaveTest.java | 135 +++++++++++++++++++ 2 files changed, 139 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/41dddb87/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java index 4f34401..2cfc0d0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java @@ -805,8 +805,8 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter fut = GridTestUtils.runAsync(new Callable() { + @Override public Void call() throws Exception { + startGrid(2); + + return null; + } + }); + + final AffinityTopologyVersion topVer = new AffinityTopologyVersion(2, 0); + + // Wait when affinity change exchange start. + boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + AffinityTopologyVersion topVer0 = + ((IgniteKernal)ignite0).context().cache().context().exchange().topologyVersion(); + + return topVer.compareTo(topVer0) < 0; + } + }, 10_000); + + assertTrue(wait); + + assertFalse(fut.isDone()); + + ignite1.close(); + + fut.get(10_000); + + Ignite ignite2 = ignite(2); + + lock = ignite2.cache(null).lock("key"); + lock.lock(); + lock.unlock(); + } + + /** + * @throws Exception If failed. + */ + public void testLockRelease3() throws Exception { + startGrid(0); + + Ignite ignite1 = startGrid(1); + + awaitPartitionMapExchange(); + + Lock lock = ignite1.cache(null).lock("key"); + lock.lock(); + + IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { + @Override public Void call() throws Exception { + startGrid(2); + + return null; + } + }); + + assertFalse(fut.isDone()); + + ignite1.close(); + + fut.get(10_000); + + Ignite ignite2 = ignite(2); + + lock = ignite2.cache(null).lock("key"); + lock.lock(); + lock.unlock(); + } + + /** + * @throws Exception If failed. + */ + public void testTxLockRelease2() throws Exception { + final Ignite ignite0 = startGrid(0); + + Ignite ignite1 = startGrid(1); + + IgniteCache cache = ignite1.cache(null); + ignite1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ); + cache.get(1); + + IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { + @Override public Void call() throws Exception { + startGrid(2); + + return null; + } + }); + + final AffinityTopologyVersion topVer = new AffinityTopologyVersion(2, 0); + + // Wait when affinity change exchange start. + boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + AffinityTopologyVersion topVer0 = + ((IgniteKernal)ignite0).context().cache().context().exchange().topologyVersion(); + + return topVer.compareTo(topVer0) < 0; + } + }, 10_000); + + assertTrue(wait); + + assertFalse(fut.isDone()); + + ignite1.close(); + + fut.get(10_000); + + Ignite ignite2 = ignite(2); + + cache = ignite2.cache(null); + + try (Transaction tx = ignite2.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + cache.get(1); + + tx.commit(); + } + } }