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 25AF11837F for ; Fri, 31 Jul 2015 12:49:35 +0000 (UTC) Received: (qmail 65579 invoked by uid 500); 31 Jul 2015 12:49:35 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 65547 invoked by uid 500); 31 Jul 2015 12:49:35 -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 65537 invoked by uid 99); 31 Jul 2015 12:49:35 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jul 2015 12:49:35 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 98C12D9349 for ; Fri, 31 Jul 2015 12:49:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.353 X-Spam-Level: X-Spam-Status: No, score=0.353 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.428, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id DAtDDyoyRB64 for ; Fri, 31 Jul 2015 12:49:30 +0000 (UTC) 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 232CA2D841 for ; Fri, 31 Jul 2015 12:49:27 +0000 (UTC) Received: (qmail 65403 invoked by uid 99); 31 Jul 2015 12:49:26 -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, 31 Jul 2015 12:49:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 82AA6E033C; Fri, 31 Jul 2015 12:49:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ntikhonov@apache.org To: commits@ignite.incubator.apache.org Date: Fri, 31 Jul 2015 12:49:34 -0000 Message-Id: <3bc9177e05404b4cbbad882e2c322000@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [9/9] incubator-ignite git commit: ignite-946: fixing version retrieval for transactions ignite-946: fixing version retrieval for transactions Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2e7799d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2e7799d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2e7799d4 Branch: refs/heads/ignite-946 Commit: 2e7799d446653bba379cc231628ba2b02c993e5e Parents: f0fe076 Author: Denis Magda Authored: Fri Jul 31 15:32:45 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jul 31 15:49:14 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/CacheInvokeEntry.java | 2 +- .../processors/cache/GridCacheMapEntry.java | 4 +- .../cache/transactions/IgniteTxAdapter.java | 14 ++- .../cache/transactions/IgniteTxEntry.java | 11 ++- .../transactions/IgniteTxLocalAdapter.java | 90 ++++++++++++++++---- 5 files changed, 98 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java index e6f8d4e..2d8f738 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java @@ -121,7 +121,7 @@ public class CacheInvokeEntry extends CacheLazyEntry implements Muta /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public T unwrap(Class cls) { - if (cls.isAssignableFrom(VersionedEntry.class)) + if (cls.isAssignableFrom(VersionedEntry.class) && ver != null) return (T)new CacheVersionedEntryImpl<>(getKey(), getValue(), ver); return super.unwrap(cls); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index ebcb908..43cf2fe 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -1653,7 +1653,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme oldVal = rawGetOrUnmarshalUnlocked(true); - CacheInvokeEntry entry = new CacheInvokeEntry(cctx, key, oldVal, this.ver); + CacheInvokeEntry entry = new CacheInvokeEntry(cctx, key, oldVal, version()); try { Object computed = entryProcessor.process(entry, invokeArgs); @@ -1878,7 +1878,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme EntryProcessor entryProcessor = (EntryProcessor)writeObj; - CacheInvokeEntry entry = new CacheInvokeEntry(cctx, key, oldVal, this.ver); + CacheInvokeEntry entry = new CacheInvokeEntry(cctx, key, oldVal, version()); try { Object computed = entryProcessor.process(entry, invokeArgs); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java index 0d14012..797f75e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java @@ -1228,9 +1228,21 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter Object key = null; + GridCacheVersion ver; + + try { + ver = txEntry.cached().version(); + } + catch (GridCacheEntryRemovedException e) { + if (log.isDebugEnabled()) + log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']'); + + ver = null; + } + for (T2, Object[]> t : txEntry.entryProcessors()) { CacheInvokeEntry invokeEntry = new CacheInvokeEntry(txEntry.context(), - txEntry.key(), key, cacheVal, val, txEntry.cached().version()); + txEntry.key(), key, cacheVal, val, ver); try { EntryProcessor processor = t.get1(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/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 7f06380..ed57bf2 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 @@ -571,10 +571,19 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message { Object val = null; Object keyVal = null; + GridCacheVersion ver; + + try { + ver = entry.version(); + } + catch (GridCacheEntryRemovedException e) { + ver = null; + } + for (T2, Object[]> t : entryProcessors()) { try { CacheInvokeEntry invokeEntry = new CacheInvokeEntry(ctx, key, keyVal, cacheVal, val, - entry.version()); + ver); EntryProcessor processor = t.get1(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/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 d8797fe..7f171c2 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 @@ -1938,13 +1938,13 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter Map drMap ) { return this.putAllAsync0(cacheCtx, - null, - null, - null, - drMap, - false, - null, - null); + null, + null, + null, + drMap, + false, + null, + null); } /** {@inheritDoc} */ @@ -2229,8 +2229,22 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter if (retval && !transform) ret.set(cacheCtx, old, true); else { - if (txEntry.op() == TRANSFORM) - addInvokeResult(txEntry, old, ret); + if (txEntry.op() == TRANSFORM) { + GridCacheVersion ver; + + try { + ver = entry.version(); + } + catch (GridCacheEntryRemovedException ex) { + if (log.isDebugEnabled()) + log.debug("Failed to get entry version: [msg=" + + ex.getMessage() + ']'); + + ver = null; + } + + addInvokeResult(txEntry, old, ret, ver); + } else ret.success(true); } @@ -2290,8 +2304,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter enlisted.add(cacheKey); - if (txEntry.op() == TRANSFORM) - addInvokeResult(txEntry, txEntry.value(), ret); + if (txEntry.op() == TRANSFORM) { + GridCacheVersion ver; + + try { + ver = entry.version(); + } + catch (GridCacheEntryRemovedException e) { + if (log.isDebugEnabled()) + log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']'); + + ver = null; + } + + addInvokeResult(txEntry, txEntry.value(), ret, ver); + } } if (!pessimistic()) { @@ -2328,8 +2355,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter CacheObject cacheVal = cacheCtx.toCacheObject(val); - if (e.op() == TRANSFORM) - addInvokeResult(e, cacheVal, ret); + if (e.op() == TRANSFORM) { + GridCacheVersion ver; + + try { + ver = e.cached().version(); + } + catch (GridCacheEntryRemovedException ex) { + if (log.isDebugEnabled()) + log.debug("Failed to get entry version: [msg=" + ex.getMessage() + ']'); + + ver = null; + } + + addInvokeResult(e, cacheVal, ret, ver); + } else ret.set(cacheCtx, cacheVal, true); } @@ -2442,8 +2482,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter } if (txEntry.op() == TRANSFORM) { - if (computeInvoke) - addInvokeResult(txEntry, v, ret); + if (computeInvoke) { + GridCacheVersion ver; + + try { + ver = cached.version(); + } + catch (GridCacheEntryRemovedException e) { + if (log.isDebugEnabled()) + log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']'); + + ver = null; + } + + addInvokeResult(txEntry, v, ret, ver); + } } else ret.value(cacheCtx, v); @@ -2510,8 +2563,10 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter * @param txEntry Entry. * @param cacheVal Value. * @param ret Return value to update. + * @param ver Entry version. */ - private void addInvokeResult(IgniteTxEntry txEntry, CacheObject cacheVal, GridCacheReturn ret) { + private void addInvokeResult(IgniteTxEntry txEntry, CacheObject cacheVal, GridCacheReturn ret, + GridCacheVersion ver) { GridCacheContext ctx = txEntry.context(); Object key0 = null; @@ -2522,8 +2577,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter for (T2, Object[]> t : txEntry.entryProcessors()) { CacheInvokeEntry invokeEntry = - new CacheInvokeEntry(txEntry.context(), txEntry.key(), key0, cacheVal, val0, - txEntry.cached().version()); + new CacheInvokeEntry(txEntry.context(), txEntry.key(), key0, cacheVal, val0, ver); EntryProcessor entryProcessor = t.get1();