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 2EFA11769F for ; Thu, 23 Apr 2015 22:56:34 +0000 (UTC) Received: (qmail 47556 invoked by uid 500); 23 Apr 2015 22:56:34 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 47492 invoked by uid 500); 23 Apr 2015 22:56:34 -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 47476 invoked by uid 99); 23 Apr 2015 22:56:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Apr 2015 22:56:34 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [54.164.171.186] (HELO mx1-us-east.apache.org) (54.164.171.186) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Apr 2015 22:56:28 +0000 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 4495B43C99 for ; Thu, 23 Apr 2015 22:56:08 +0000 (UTC) Received: (qmail 45839 invoked by uid 99); 23 Apr 2015 22:56:07 -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, 23 Apr 2015 22:56:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B7408E17F8; Thu, 23 Apr 2015 22:56:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 23 Apr 2015 22:56:16 -0000 Message-Id: In-Reply-To: <2e85f10d65cb4ec49281deb7d959af03@git.apache.org> References: <2e85f10d65cb4ec49281deb7d959af03@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/50] incubator-ignite git commit: ignite-656: fixing get() for pessimistic mode X-Virus-Checked: Checked by ClamAV on apache.org ignite-656: fixing get() for pessimistic mode Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8d18956f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8d18956f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8d18956f Branch: refs/heads/ignite-286 Commit: 8d18956fd5ab04288dd72dde6f59e7fae2187c34 Parents: 56a6348 Author: Denis Magda Authored: Tue Apr 14 18:15:51 2015 +0300 Committer: Denis Magda Committed: Tue Apr 14 18:15:51 2015 +0300 ---------------------------------------------------------------------- .../colocated/GridDhtColocatedLockFuture.java | 3 +- .../distributed/near/GridNearLockFuture.java | 3 +- .../distributed/near/GridNearLockRequest.java | 5 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 71 ++++++++++++++++++-- 4 files changed, 73 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java index 7b05065..515e5f7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java @@ -746,7 +746,8 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentity key, retval, dhtVer, // Include DHT version to match remote DHT entry. - cctx); + cctx, + entry.context().skipStore()); } explicit = inTx() && cand == null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java index 789fd93..68d98e7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java @@ -882,7 +882,8 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture)null, ctx, false); //TODO: revisit + addKeyBytes(key, retVal, (Collection)null, ctx, skipStore); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d18956f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index b2368ff..684b5b5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -4426,8 +4426,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract assertTrue(map.size() == 0); if (atomicityMode() == CacheAtomicityMode.TRANSACTIONAL) { - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC, + /*checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED); + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC, + TransactionIsolation.REPEATABLE_READ); + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.OPTIMISTIC, + TransactionIsolation.SERIALIZABLE);*/ + + //checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.PESSIMISTIC, + // TransactionIsolation.READ_COMMITTED); + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.PESSIMISTIC, + TransactionIsolation.REPEATABLE_READ); + //checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, TransactionConcurrency.PESSIMISTIC, + // TransactionIsolation.SERIALIZABLE); } } @@ -4472,6 +4483,16 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } } + /** + * @param cache Cache instance. + * @param cacheSkipStore Cache skip store projection. + * @param data Data set. + * @param keys Keys list. + * @param txConcurrency Concurrency mode. + * @param txIsolation Isolation mode. + * + * @throws Exception If failed. + */ private void checkSkipStoreWithTransaction(IgniteCache cache, IgniteCache cacheSkipStore, Map data, @@ -4480,10 +4501,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract TransactionIsolation txIsolation) throws Exception { cache.removeAll(data.keySet()); - - assertTrue(cache.size(CachePeekMode.ALL) == 0); - assertTrue(cacheSkipStore.size(CachePeekMode.ALL) == 0); - assertTrue(map.size() == 0); + checkEmpty(cache, cacheSkipStore); IgniteTransactions txs = grid(0).transactions(); @@ -4522,6 +4540,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx.commit(); + assertTrue(map.size() == 0); + // cache putAll(..)/removeAll(..) check tx = txs.txStart(txConcurrency, txIsolation); @@ -4543,6 +4563,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx.commit(); + assertTrue(map.size() == 0); + // putAll(..) from both cacheSkipStore and cache tx = txs.txStart(txConcurrency, txIsolation); @@ -4590,6 +4612,45 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract assertNull(cache.get(key)); assertFalse(map.containsKey(key)); } + + // Check that read-through is disabled when cacheSkipStore is used + for (int i = 0; i < keys.size(); i++) + putToStore(keys.get(i), i); + + assertTrue(cacheSkipStore.size(CachePeekMode.ALL) == 0); + assertTrue(cache.size(CachePeekMode.ALL) == 0); + assertTrue(map.size() != 0); + + tx = txs.txStart(txConcurrency, txIsolation); + + //assertTrue(cacheSkipStore.getAll(data.keySet()).size() == 0); + + for (String key : keys) { + assertNull(cacheSkipStore.get(key)); + + if (txIsolation == READ_COMMITTED) { + assertNotNull(cache.get(key)); + assertNotNull(cacheSkipStore.get(key)); + } + } + + tx.commit(); + + cache.removeAll(data.keySet()); + checkEmpty(cache, cacheSkipStore); + } + + /** + * @param cache Cache instance. + * @param cacheSkipStore Cache skip store projection. + * + * @throws Exception If failed. + */ + private void checkEmpty(IgniteCache cache, IgniteCache cacheSkipStore) + throws Exception { + assertTrue(cache.size(CachePeekMode.ALL) == 0); + assertTrue(cacheSkipStore.size(CachePeekMode.ALL) == 0); + assertTrue(map.size() == 0); } /**