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 AF60B200D18 for ; Wed, 11 Oct 2017 12:54:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id ADF931609CA; Wed, 11 Oct 2017 10:54:24 +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 2C945160BEC for ; Wed, 11 Oct 2017 12:54:23 +0200 (CEST) Received: (qmail 62139 invoked by uid 500); 11 Oct 2017 10:43:20 -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 62058 invoked by uid 99); 11 Oct 2017 10:43:20 -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, 11 Oct 2017 10:43:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DFE81F5D5A; Wed, 11 Oct 2017 10:42:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Wed, 11 Oct 2017 10:43:06 -0000 Message-Id: <0a9f882362974679a0b63f58eeef808c@git.apache.org> In-Reply-To: <99e612c1b0904d32bc44de6630ca65d3@git.apache.org> References: <99e612c1b0904d32bc44de6630ca65d3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/17] ignite git commit: ignite-5937 archived-at: Wed, 11 Oct 2017 10:54:24 -0000 ignite-5937 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0bbbbe29 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0bbbbe29 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0bbbbe29 Branch: refs/heads/ignite-5932 Commit: 0bbbbe2909718a171f2c4e31d39851220f4b646a Parents: 5c195c3 Author: sboikov Authored: Mon Oct 9 16:24:30 2017 +0300 Committer: sboikov Committed: Mon Oct 9 16:24:30 2017 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheMapEntry.java | 20 ++++++++-- .../cache/IgniteCacheOffheapManager.java | 20 +++++++++- .../cache/IgniteCacheOffheapManagerImpl.java | 39 +++++++++++++++++++- .../persistence/GridCacheOffheapManager.java | 17 ++++++++- .../processors/cache/tree/MvccUpdateRow.java | 28 ++++++++++++-- 5 files changed, 112 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0bbbbe29/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 00307a5..4b71a7b 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 @@ -1012,7 +1012,11 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme if (cctx.mvccEnabled() && !((IgniteCacheOffheapManagerImpl)cctx.offheap()).IGNITE_FAKE_MVCC_STORAGE) { assert mvccVer != null; - mvccWaitTxs = cctx.offheap().mvccUpdate(this, val, newVer, mvccVer); + mvccWaitTxs = cctx.offheap().mvccUpdate(tx.local(), + this, + val, + newVer, + mvccVer); } else storeValue(val, expireTime, newVer, null); @@ -1141,6 +1145,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme boolean marked = false; + GridLongList mvccWaitTxs = null; + synchronized (this) { checkObsolete(); @@ -1181,7 +1187,13 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } } - removeValue(); + if (cctx.mvccEnabled() && !((IgniteCacheOffheapManagerImpl)cctx.offheap()).IGNITE_FAKE_MVCC_STORAGE) { + assert mvccVer != null; + + mvccWaitTxs = cctx.offheap().mvccRemove(tx.local(), this, mvccVer); + } + else + removeValue(); update(null, 0, 0, newVer, true); @@ -1292,7 +1304,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme cctx.config().getInterceptor().onAfterRemove(entry0); if (valid) - return new GridCacheUpdateTxResult(true, updateCntr0, null); + return new GridCacheUpdateTxResult(true, updateCntr0, mvccWaitTxs); else return new GridCacheUpdateTxResult(false); } @@ -2593,7 +2605,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme if (val != null) { if (cctx.mvccEnabled()) - cctx.offheap().mvccUpdate(this, val, ver, mvccVer); + cctx.offheap().mvccUpdate(false, this, val, ver, mvccVer); else storeValue(val, expTime, ver, null); } http://git-wip-us.apache.org/repos/asf/ignite/blob/0bbbbe29/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java index 8967ce8..bee2108 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java @@ -196,10 +196,19 @@ public interface IgniteCacheOffheapManager { * @return Transactions to wait for before finishing current transaction. * @throws IgniteCheckedException If failed. */ - @Nullable public GridLongList mvccUpdate(GridCacheMapEntry entry, + @Nullable public GridLongList mvccUpdate( + boolean primary, + GridCacheMapEntry entry, CacheObject val, GridCacheVersion ver, - MvccCoordinatorVersion mvccVer) throws IgniteCheckedException; + MvccCoordinatorVersion mvccVer + ) throws IgniteCheckedException; + + @Nullable public GridLongList mvccRemove( + boolean primary, + GridCacheMapEntry entry, + MvccCoordinatorVersion mvccVer + ) throws IgniteCheckedException; /** * @param cctx Cache context. @@ -503,11 +512,18 @@ public interface IgniteCacheOffheapManager { */ @Nullable GridLongList mvccUpdate( GridCacheContext cctx, + boolean primary, KeyCacheObject key, CacheObject val, GridCacheVersion ver, MvccCoordinatorVersion mvccVer) throws IgniteCheckedException; + @Nullable GridLongList mvccRemove( + GridCacheContext cctx, + boolean primary, + KeyCacheObject key, + MvccCoordinatorVersion mvccVer) throws IgniteCheckedException; + /** * @param cctx Cache context. * @param key Key. http://git-wip-us.apache.org/repos/asf/ignite/blob/0bbbbe29/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index 25f36b2..dd4d7e0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java @@ -380,11 +380,14 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager } /** {@inheritDoc} */ - @Override public GridLongList mvccUpdate(GridCacheMapEntry entry, + @Override public GridLongList mvccUpdate( + boolean primary, + GridCacheMapEntry entry, CacheObject val, GridCacheVersion ver, MvccCoordinatorVersion mvccVer) throws IgniteCheckedException { return dataStore(entry.localPartition()).mvccUpdate(entry.context(), + primary, entry.key(), val, ver, @@ -392,6 +395,19 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager } /** {@inheritDoc} */ + @Override public GridLongList mvccRemove( + boolean primary, + GridCacheMapEntry entry, + MvccCoordinatorVersion mvccVer + ) + throws IgniteCheckedException { + return dataStore(entry.localPartition()).mvccRemove(entry.context(), + primary, + entry.key(), + mvccVer); + } + + /** {@inheritDoc} */ @Override public void updateIndexes(GridCacheContext cctx, KeyCacheObject key, GridDhtLocalPartition part) throws IgniteCheckedException { dataStore(part).updateIndexes(cctx, key); @@ -1350,8 +1366,29 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager } /** {@inheritDoc} */ + @Override public GridLongList mvccRemove(GridCacheContext cctx, + boolean primary, + KeyCacheObject key, + MvccCoordinatorVersion mvccVer) throws IgniteCheckedException { + assert mvccVer != null; + + if (!busyLock.enterBusy()) + throw new NodeStoppingException("Operation has been cancelled (node is stopping)."); + + try { + + + return null; + } + finally { + busyLock.leaveBusy(); + } + } + + /** {@inheritDoc} */ @Override public GridLongList mvccUpdate( GridCacheContext cctx, + boolean primary, KeyCacheObject key, CacheObject val, GridCacheVersion ver, http://git-wip-us.apache.org/repos/asf/ignite/blob/0bbbbe29/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java index cb01b6c..1f52309 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java @@ -1251,14 +1251,27 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple } /** {@inheritDoc} */ - @Override public GridLongList mvccUpdate(GridCacheContext cctx, + @Override public GridLongList mvccUpdate( + GridCacheContext cctx, + boolean primary, KeyCacheObject key, CacheObject val, GridCacheVersion ver, MvccCoordinatorVersion mvccVer) throws IgniteCheckedException { CacheDataStore delegate = init0(false); - return delegate.mvccUpdate(cctx, key, val, ver, mvccVer); + return delegate.mvccUpdate(cctx, primary, key, val, ver, mvccVer); + } + + /** {@inheritDoc} */ + @Override public GridLongList mvccRemove( + GridCacheContext cctx, + boolean primary, + KeyCacheObject key, + MvccCoordinatorVersion mvccVer) throws IgniteCheckedException { + CacheDataStore delegate = init0(false); + + return delegate.mvccRemove(cctx, primary, key, mvccVer); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/0bbbbe29/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccUpdateRow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccUpdateRow.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccUpdateRow.java index 79544e6..d3303e8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccUpdateRow.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccUpdateRow.java @@ -92,6 +92,29 @@ public class MvccUpdateRow extends DataRow implements BPlusTree.TreeRowClosure 0 : "[updCrd=" + mvccCoordinatorVersion() + + ", updCntr=" + mvccCounter() + + ", rowCrd=" + rowCrdVer + + ", rowCntr=" + rowCntr + ']'; + + return true; + } + /** {@inheritDoc} */ @Override public boolean apply(BPlusTree tree, BPlusIO io, @@ -101,9 +124,8 @@ public class MvccUpdateRow extends DataRow implements BPlusTree.TreeRowClosure= rowIo.getMvccCoordinatorVersion(pageAddr, idx); - assert mvccVer.coordinatorVersion() > rowIo.getMvccCoordinatorVersion(pageAddr, idx) || mvccVer.counter() > rowIo.getMvccCounter(pageAddr, idx); + // All previous versions should be less then new one. + assert assertVersionGreater(rowIo, pageAddr, idx); boolean checkActive = mvccVer.activeTransactions().size() > 0;