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 AF2981757B for ; Thu, 2 Apr 2015 10:24:03 +0000 (UTC) Received: (qmail 76639 invoked by uid 500); 2 Apr 2015 10:24:03 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 76565 invoked by uid 500); 2 Apr 2015 10:24:03 -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 76509 invoked by uid 99); 2 Apr 2015 10:24:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2015 10:24:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_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, 02 Apr 2015 10:24:01 +0000 Received: (qmail 76245 invoked by uid 99); 2 Apr 2015 10:23:41 -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, 02 Apr 2015 10:23:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 15A15E2F37; Thu, 2 Apr 2015 10:23:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 02 Apr 2015 10:23:46 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/50] incubator-ignite git commit: IGNITE-651 - Fixed system transactions test since marshaller cache is not transactional anymore. X-Virus-Checked: Checked by ClamAV on apache.org IGNITE-651 - Fixed system transactions test since marshaller cache is not transactional anymore. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ca472ac5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ca472ac5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ca472ac5 Branch: refs/heads/ignite-593 Commit: ca472ac50c3e679a305bb9a01a56b180ac3fff82 Parents: 685209c Author: Alexey Goncharuk Authored: Tue Mar 31 18:46:45 2015 -0700 Committer: Alexey Goncharuk Committed: Tue Mar 31 18:46:45 2015 -0700 ---------------------------------------------------------------------- .../ignite/internal/MarshallerContextImpl.java | 2 +- .../transactions/IgniteTransactionsImpl.java | 4 +++ .../IgniteCacheSystemTransactionsSelfTest.java | 38 ++++++-------------- 3 files changed, 15 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca472ac5/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java index 4a27222..e6ef192 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java @@ -158,7 +158,7 @@ public class MarshallerContextImpl extends MarshallerContextAdapter { @Override public void onUpdated(Iterable> events) throws CacheEntryListenerException { for (CacheEntryEvent evt : events) { - assert evt.getOldValue() == null; + assert evt.getOldValue() == null : "Received non-null old value for system marshaller cache: " + evt; File file = new File(workDir, evt.getKey() + ".classname"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca472ac5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java index afa2826..c3ad32b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.transactions; +import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; @@ -137,6 +138,9 @@ public class IgniteTransactionsImpl implements IgniteTransactionsEx { long timeout, int txSize, @Nullable GridCacheContext sysCacheCtx) { TransactionConfiguration cfg = cctx.gridConfig().getTransactionConfiguration(); + if (sysCacheCtx != null && !sysCacheCtx.transactional()) + throw new IgniteException("Failed to start transaction on non-transactional cache: " + sysCacheCtx.name()); + if (!cfg.isTxSerializableEnabled() && isolation == SERIALIZABLE) throw new IllegalArgumentException("SERIALIZABLE isolation level is disabled (to enable change " + "'txSerializableEnabled' configuration property)"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca472ac5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java index f06838a..d4c3a1b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java @@ -24,9 +24,11 @@ import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.*; import org.apache.ignite.transactions.*; import java.util.*; +import java.util.concurrent.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.transactions.TransactionConcurrency.*; @@ -101,38 +103,18 @@ public class IgniteCacheSystemTransactionsSelfTest extends GridCacheAbstractSelf /** * @throws Exception If failed. */ - public void testSystemMarshallerTxInsideSystemTx() throws Exception { + public void testMarshallerCacheShouldNotStartTx() throws Exception { IgniteKernal ignite = (IgniteKernal)grid(0); - GridCacheAdapter utilityCache = ignite.context().cache().utilityCache(); + final GridCacheAdapter marshallerCache = (GridCacheAdapter)(GridCacheAdapter) + ignite.context().cache().marshallerCache(); - try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { - utilityCache.get("1"); - utilityCache.put("1", "11"); - - GridCacheAdapter marshallerCache = (GridCacheAdapter)(GridCacheAdapter)ignite.context().cache().marshallerCache(); - - marshallerCache.putIfAbsent("2", "2"); - - try (IgniteInternalTx itx = marshallerCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { - assertEquals(null, marshallerCache.get("1")); - assertEquals("2", marshallerCache.get("2")); - assertEquals(null, marshallerCache.get("3")); - - marshallerCache.put("3", "3"); - - itx.commit(); + GridTestUtils.assertThrows(log, new Callable() { + @Override + public Object call() throws Exception { + return marshallerCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); } - - utilityCache.put("2", "22"); - - tx.commit(); - } - - checkTransactionsCommitted(); - - checkEntries(CU.UTILITY_CACHE_NAME, 1, "11", 2, "22", 3, null); - checkEntries(CU.MARSH_CACHE_NAME, 1, null, 2, "2", 3, "3"); + }, IgniteException.class, null); } /**