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 C729C186C3 for ; Fri, 24 Apr 2015 07:02:30 +0000 (UTC) Received: (qmail 73218 invoked by uid 500); 24 Apr 2015 07:02:30 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 73187 invoked by uid 500); 24 Apr 2015 07:02:30 -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 73178 invoked by uid 99); 24 Apr 2015 07:02:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Apr 2015 07:02:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of root@apache.org designates 54.76.25.247 as permitted sender) Received: from [54.76.25.247] (HELO mx1-eu-west.apache.org) (54.76.25.247) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Apr 2015 07:02:05 +0000 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 862E125FB8 for ; Fri, 24 Apr 2015 07:01:41 +0000 (UTC) Received: (qmail 70241 invoked by uid 99); 24 Apr 2015 07:01:38 -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; Fri, 24 Apr 2015 07:01:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EFDE8E2EEE; Fri, 24 Apr 2015 07:01:37 +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: Fri, 24 Apr 2015 07:02:11 -0000 Message-Id: <7092db9dc73e4bce9357c7090464dd13@git.apache.org> In-Reply-To: <6a86f978602e44639622fb07ba26a81d@git.apache.org> References: <6a86f978602e44639622fb07ba26a81d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [35/50] incubator-ignite git commit: # ignite-656 fixes for tx cache X-Virus-Checked: Checked by ClamAV on apache.org # ignite-656 fixes for tx cache Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f910bb69 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f910bb69 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f910bb69 Branch: refs/heads/ignite-157-1 Commit: f910bb691a3e20ef8f7e28c6cef3e6aa82f94733 Parents: e55cabb Author: sboikov Authored: Thu Apr 23 12:26:19 2015 +0300 Committer: sboikov Committed: Thu Apr 23 13:34:30 2015 +0300 ---------------------------------------------------------------------- .../distributed/dht/GridDhtTxPrepareFuture.java | 6 +- .../cache/transactions/IgniteTxEntry.java | 1 + .../transactions/IgniteTxLocalAdapter.java | 10 ++- .../cache/GridCacheAbstractFullApiSelfTest.java | 66 ++++++++++++++------ 4 files changed, 59 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f910bb69/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 2eb79fe..f7b29b5 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 @@ -295,10 +295,14 @@ public final class GridDhtTxPrepareFuture extends GridCompoundIdentityFutu if (hasFilters || retVal || txEntry.op() == GridCacheOperation.DELETE) { cached.unswap(retVal); + boolean readThrough = (retVal || hasFilters) && + cacheCtx.config().isLoadPreviousValue() && + !txEntry.skipStore(); + CacheObject val = cached.innerGet( tx, /*swap*/true, - /*read through*/(retVal || hasFilters) && cacheCtx.config().isLoadPreviousValue(), + readThrough, /*fail fast*/false, /*unmarshal*/true, /*metrics*/retVal, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f910bb69/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java index 43450bd..0d7aeaf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java @@ -314,6 +314,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message { cp.grpLock = grpLock; cp.conflictVer = conflictVer; cp.expiryPlc = expiryPlc; + cp.flags = flags; return cp; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f910bb69/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index d93c80e..67609ca 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -2095,7 +2095,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter CacheObject old = null; - boolean readThrough = !F.isEmptyOrNulls(filter) && !F.isAlwaysTrue(filter); + boolean readThrough = !skipStore && !F.isEmptyOrNulls(filter) && !F.isAlwaysTrue(filter); if (optimistic() && !implicit()) { try { @@ -2390,10 +2390,13 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter if (retval || invoke) { if (!cacheCtx.isNear()) { try { - if (!hasPrevVal) + if (!hasPrevVal) { + boolean readThrough = + (invoke || cacheCtx.loadPreviousValue()) && !txEntry.skipStore(); + v = cached.innerGet(this, /*swap*/true, - /*read-through*/invoke || cacheCtx.loadPreviousValue(), + readThrough, /*failFast*/false, /*unmarshal*/true, /*metrics*/!invoke, @@ -2403,6 +2406,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter null, resolveTaskName(), null); + } } catch (GridCacheFilterFailedException e) { e.printStackTrace(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f910bb69/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 59b6b54..ff4a417 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 @@ -4310,11 +4310,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (String key : keys) assertNull(cache.get(key)); + final int KEYS = 500; + // Put/remove data from multiple nodes. - keys = new ArrayList<>(1000); + keys = new ArrayList<>(KEYS); - for (int i = 0; i < 1000; i++) + for (int i = 0; i < KEYS; i++) keys.add("key_" + i); for (int i = 0; i < keys.size(); ++i) @@ -4392,7 +4394,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract // putAll/removeAll from multiple nodes. - Map data = new HashMap<>(); + Map data = new LinkedHashMap<>(); for (int i = 0; i < keys.size(); i++) data.put(keys.get(i), i); @@ -4483,29 +4485,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.remove(rmvKey); assertTrue(map.size() == 0); - - if (txEnabled()) { - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, OPTIMISTIC,READ_COMMITTED); - - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, OPTIMISTIC, REPEATABLE_READ); - - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, OPTIMISTIC, SERIALIZABLE); - - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, PESSIMISTIC, READ_COMMITTED); - - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, PESSIMISTIC, REPEATABLE_READ); - - checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, PESSIMISTIC, SERIALIZABLE); - } } /** * @throws Exception If failed. */ public void testWithSkipStoreRemoveAll() throws Exception { - if (atomicityMode() == TRANSACTIONAL || - (atomicityMode() == ATOMIC && nearEnabled())) - fail("https://issues.apache.org/jira/browse/IGNITE-373"); + if (atomicityMode() == TRANSACTIONAL || (atomicityMode() == ATOMIC && nearEnabled())) // TODO IGNITE-373. + return; IgniteCache cache = grid(0).cache(null); @@ -4542,6 +4529,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } /** + * @throws Exception If failed. + */ + public void testWithSkipStoreTx() throws Exception { + if (txEnabled()) { + IgniteCache cache = grid(0).cache(null); + + IgniteCache cacheSkipStore = cache.withSkipStore(); + + final int KEYS = 500; + + // Put/remove data from multiple nodes. + + List keys = new ArrayList<>(KEYS); + + for (int i = 0; i < KEYS; i++) + keys.add("key_" + i); + + Map data = new LinkedHashMap<>(); + + for (int i = 0; i < keys.size(); i++) + data.put(keys.get(i), i); + + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, OPTIMISTIC, READ_COMMITTED); + + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, OPTIMISTIC, REPEATABLE_READ); + + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, OPTIMISTIC, SERIALIZABLE); + + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, PESSIMISTIC, READ_COMMITTED); + + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, PESSIMISTIC, REPEATABLE_READ); + + checkSkipStoreWithTransaction(cache, cacheSkipStore, data, keys, PESSIMISTIC, SERIALIZABLE); + } + } + + /** * @param cache Cache instance. * @param cacheSkipStore Cache skip store projection. * @param data Data set. @@ -4559,6 +4583,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract TransactionIsolation txIsolation) throws Exception { + log.info("Test tx skip store [concurrency=" + txConcurrency + ", isolation=" + txIsolation + ']'); + cache.removeAll(data.keySet()); checkEmpty(cache, cacheSkipStore);