ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [19/36] ignite git commit: ignite-3484
Date Fri, 08 Sep 2017 12:35:51 GMT
ignite-3484


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b4bfcde7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b4bfcde7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b4bfcde7

Branch: refs/heads/ignite-6149
Commit: b4bfcde78825c6517232e49d389bdb5de19f05a9
Parents: bc9134c
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Sep 5 15:27:51 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Sep 5 16:02:07 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheGroupContext.java     |  4 ++
 .../cache/persistence/CacheDataRowAdapter.java  | 10 +++
 .../persistence/GridCacheOffheapManager.java    | 10 +++
 .../cache/persistence/tree/io/PageIO.java       | 14 +++++
 .../cache/tree/AbstractDataInnerIO.java         |  1 -
 .../cache/tree/AbstractDataLeafIO.java          | 50 +++++++++++++--
 .../processors/cache/tree/CacheDataTree.java    | 45 ++++++++++++--
 .../cache/tree/CacheIdAwareDataInnerIO.java     | 16 +++++
 .../cache/tree/CacheIdAwareDataLeafIO.java      | 16 +++++
 .../processors/cache/tree/DataInnerIO.java      | 16 +++++
 .../processors/cache/tree/DataLeafIO.java       | 16 +++++
 .../processors/cache/tree/MvccDataInnerIO.java  | 64 ++++++++++++++++++++
 .../processors/cache/tree/MvccDataLeafIO.java   | 64 ++++++++++++++++++++
 .../processors/cache/tree/RowLinkIO.java        |  4 ++
 .../processors/cache/tree/SearchRow.java        | 10 +++
 .../database/FreeListImplSelfTest.java          | 10 +++
 16 files changed, 340 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index 5e5e02e..df21d1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -195,6 +195,10 @@ public class CacheGroupContext {
         caches = new ArrayList<>();
     }
 
+    public boolean mvccEnabled() {
+        return ccfg.isMvccEnabled();
+    }
+
     /**
      * @return {@code True} if this is cache group for one of system caches.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
index 4d75475..bb824dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
@@ -572,6 +572,16 @@ public class CacheDataRowAdapter implements CacheDataRow {
         throw new UnsupportedOperationException();
     }
 
+    /** {@inheritDoc} */
+    @Override public long mvccUpdateCounter() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long mvccUpdateTopologyVersion() {
+        return 0;
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/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 6c8d090..3c9b1ca 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
@@ -822,6 +822,16 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl
imple
         @Override public int cacheId() {
             return entry.cacheId();
         }
+
+        /** {@inheritDoc} */
+        @Override public long mvccUpdateCounter() {
+            return 0; // TODO IGNITE-3478.
+        }
+
+        /** {@inheritDoc} */
+        @Override public long mvccUpdateTopologyVersion() {
+            return 0; // TODO IGNITE-3478.
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
index da9b818..9e50f41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
@@ -35,6 +35,8 @@ import org.apache.ignite.internal.processors.cache.tree.CacheIdAwarePendingEntry
 import org.apache.ignite.internal.processors.cache.tree.CacheIdAwarePendingEntryLeafIO;
 import org.apache.ignite.internal.processors.cache.tree.DataInnerIO;
 import org.apache.ignite.internal.processors.cache.tree.DataLeafIO;
+import org.apache.ignite.internal.processors.cache.tree.MvccDataInnerIO;
+import org.apache.ignite.internal.processors.cache.tree.MvccDataLeafIO;
 import org.apache.ignite.internal.processors.cache.tree.PendingEntryInnerIO;
 import org.apache.ignite.internal.processors.cache.tree.PendingEntryLeafIO;
 
@@ -192,6 +194,12 @@ public abstract class PageIO {
     public static final short T_H2_EX_REF_INNER_END = T_H2_EX_REF_INNER_START + MAX_PAYLOAD_SIZE
- 1;
 
     /** */
+    public static final short T_DATA_REF_MVCC_INNER = 21;
+
+    /** */
+    public static final short T_DATA_REF_MVCC_LEAF = 22;
+
+    /** */
     private final int ver;
 
     /** */
@@ -515,6 +523,12 @@ public abstract class PageIO {
             case T_CACHE_ID_AWARE_DATA_REF_LEAF:
                 return (Q)CacheIdAwareDataLeafIO.VERSIONS.forVersion(ver);
 
+            case T_DATA_REF_MVCC_INNER:
+                return (Q)MvccDataInnerIO.VERSIONS.forVersion(ver);
+
+            case T_DATA_REF_MVCC_LEAF:
+                return (Q)MvccDataLeafIO.VERSIONS.forVersion(ver);
+
             case T_METASTORE_INNER:
                 return (Q)MetadataStorage.MetaStoreInnerIO.VERSIONS.forVersion(ver);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
index 8ad6666..489fd02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataInnerIO.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.tree;
 
 import org.apache.ignite.internal.pagemem.PageUtils;
-import org.apache.ignite.internal.processors.cache.GridCacheUtils;
 import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
 import org.apache.ignite.internal.processors.cache.persistence.CacheSearchRow;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
index e9a3a9b..5b94a15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/AbstractDataLeafIO.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.tree;
 
 import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
 import org.apache.ignite.internal.processors.cache.persistence.CacheSearchRow;
 import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
@@ -44,31 +45,65 @@ public abstract class AbstractDataLeafIO extends BPlusLeafIO<CacheSearchRow>
imp
         assert row.link() != 0;
 
         PageUtils.putLong(pageAddr, off, row.link());
-        PageUtils.putInt(pageAddr, off + 8, row.hash());
+        off += 8;
+
+        PageUtils.putInt(pageAddr, off, row.hash());
+        off += 4;
 
         if (storeCacheId()) {
             assert row.cacheId() != CU.UNDEFINED_CACHE_ID;
 
-            PageUtils.putInt(pageAddr, off + 12, row.cacheId());
+            PageUtils.putInt(pageAddr, off, row.cacheId());
+            off += 4;
+        }
+
+        if (storeMvccVersion()) {
+            long mvccUpdateTopVer = row.mvccUpdateTopologyVersion();
+            long mvccUpdateCntr = row.mvccUpdateCounter();
+
+            assert mvccUpdateTopVer > 0 : mvccUpdateCntr;
+            assert mvccUpdateCntr != TxMvccVersion.COUNTER_NA;
+
+            PageUtils.putLong(pageAddr, off, mvccUpdateTopVer);
+            off += 8;
+
+            PageUtils.putLong(pageAddr, off, mvccUpdateCntr);
         }
     }
 
     /** {@inheritDoc} */
     @Override public void store(long dstPageAddr, int dstIdx, BPlusIO<CacheSearchRow>
srcIo, long srcPageAddr,
-                                int srcIdx) {
+        int srcIdx) {
         int hash = ((RowLinkIO)srcIo).getHash(srcPageAddr, srcIdx);
         long link = ((RowLinkIO)srcIo).getLink(srcPageAddr, srcIdx);
         int off = offset(dstIdx);
 
         PageUtils.putLong(dstPageAddr, off, link);
-        PageUtils.putInt(dstPageAddr, off + 8, hash);
+        off += 8;
+
+        PageUtils.putInt(dstPageAddr, off, hash);
+        off += 4;
 
         if (storeCacheId()) {
             int cacheId = ((RowLinkIO)srcIo).getCacheId(srcPageAddr, srcIdx);
 
             assert cacheId != CU.UNDEFINED_CACHE_ID;
 
-            PageUtils.putInt(dstPageAddr, off + 12, cacheId);
+            PageUtils.putInt(dstPageAddr, off, cacheId);
+            off += 4;
+        }
+
+        if (storeMvccVersion()) {
+            long mvccUpdateTopVer = ((RowLinkIO)srcIo).getMvccUpdateTopologyVersion(srcPageAddr,
srcIdx);
+            long mvccUpdateCntr = ((RowLinkIO)srcIo).getMvccUpdateCounter(srcPageAddr, srcIdx);
+
+            assert mvccUpdateTopVer >=0 : mvccUpdateCntr;
+            assert mvccUpdateCntr != TxMvccVersion.COUNTER_NA;
+
+            PageUtils.putLong(dstPageAddr, off, mvccUpdateTopVer);
+            off += 8;
+
+            PageUtils.putLong(dstPageAddr, off, mvccUpdateCntr);
         }
     }
 
@@ -105,4 +140,9 @@ public abstract class AbstractDataLeafIO extends BPlusLeafIO<CacheSearchRow>
imp
      * @return {@code True} if cache ID has to be stored.
      */
     protected abstract boolean storeCacheId();
+
+    /**
+     * @return {@code True} if mvcc version has to be stored.
+     */
+    abstract boolean storeMvccVersion();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index 36306cb..6ed1c74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -21,6 +21,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.pagemem.PageUtils;
 import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
 import org.apache.ignite.internal.processors.cache.persistence.CacheSearchRow;
@@ -28,6 +29,7 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPagePayload;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
 import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -46,7 +48,7 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow>
{
     private final CacheGroupContext grp;
 
     /**
-     * @param grp Ccahe group.
+     * @param grp Cache group.
      * @param name Tree name.
      * @param reuseList Reuse list.
      * @param rowStore Row store.
@@ -69,8 +71,8 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow>
{
             grp.offheap().globalRemoveId(),
             metaPageId,
             reuseList,
-            grp.sharedGroup() ? CacheIdAwareDataInnerIO.VERSIONS : DataInnerIO.VERSIONS,
-            grp.sharedGroup() ? CacheIdAwareDataLeafIO.VERSIONS : DataLeafIO.VERSIONS);
+            innerIO(grp),
+            leafIO(grp));
 
         assert rowStore != null;
 
@@ -80,6 +82,20 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow>
{
         initTree(initNew);
     }
 
+    private static IOVersions<? extends AbstractDataInnerIO> innerIO(CacheGroupContext
grp) {
+        if (grp.mvccEnabled())
+            return MvccDataInnerIO.VERSIONS;
+
+        return grp.sharedGroup() ? CacheIdAwareDataInnerIO.VERSIONS : DataInnerIO.VERSIONS;
+    }
+
+    private static IOVersions<? extends AbstractDataLeafIO> leafIO(CacheGroupContext
grp) {
+        if (grp.mvccEnabled())
+            return MvccDataLeafIO.VERSIONS;
+
+        return grp.sharedGroup() ? CacheIdAwareDataLeafIO.VERSIONS : DataLeafIO.VERSIONS;
+    }
+
     /**
      * @return Row store.
      */
@@ -127,7 +143,28 @@ public class CacheDataTree extends BPlusTree<CacheSearchRow, CacheDataRow>
{
 
         assert row.key() != null : row;
 
-        return compareKeys(row.key(), link);
+        cmp = compareKeys(row.key(), link);
+
+        if (cmp != 0 || !grp.mvccEnabled())
+            return 0;
+
+        long mvccTopVer = io.getMvccUpdateTopologyVersion(pageAddr, idx);
+
+        if (mvccTopVer == 0)
+            return 0;
+
+        cmp = Long.compare(mvccTopVer, row.mvccUpdateTopologyVersion());
+
+        if (cmp != 0)
+            return 0;
+
+        long mvccCntr = io.getMvccUpdateCounter(pageAddr, idx);
+
+        assert row.mvccUpdateCounter() != TxMvccVersion.COUNTER_NA;
+
+        cmp = Long.compare(mvccCntr, row.mvccUpdateCounter());
+
+        return cmp;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataInnerIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataInnerIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataInnerIO.java
index acb42a0..6922302 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataInnerIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataInnerIO.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.tree;
 
 import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
 
 /**
@@ -45,4 +46,19 @@ public final class CacheIdAwareDataInnerIO extends AbstractDataInnerIO
{
     @Override protected boolean storeCacheId() {
         return true;
     }
+
+    /** {@inheritDoc} */
+    @Override protected boolean storeMvccVersion() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateTopologyVersion(long pageAddr, int idx) {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateCounter(long pageAddr, int idx) {
+        return TxMvccVersion.COUNTER_NA;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataLeafIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataLeafIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataLeafIO.java
index 7263168..b57fe94 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataLeafIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheIdAwareDataLeafIO.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.tree;
 
 import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
 
 /**
@@ -45,4 +46,19 @@ public final class CacheIdAwareDataLeafIO extends AbstractDataLeafIO {
     @Override protected boolean storeCacheId() {
         return true;
     }
+
+    /** {@inheritDoc} */
+    @Override boolean storeMvccVersion() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateTopologyVersion(long pageAddr, int idx) {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateCounter(long pageAddr, int idx) {
+        return TxMvccVersion.COUNTER_NA;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataInnerIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataInnerIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataInnerIO.java
index 8625338..b070de0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataInnerIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataInnerIO.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.tree;
 
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 
@@ -45,4 +46,19 @@ public final class DataInnerIO extends AbstractDataInnerIO {
     @Override protected boolean storeCacheId() {
         return false;
     }
+
+    /** {@inheritDoc} */
+    @Override protected boolean storeMvccVersion() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateTopologyVersion(long pageAddr, int idx) {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateCounter(long pageAddr, int idx) {
+        return TxMvccVersion.COUNTER_NA;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataLeafIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataLeafIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataLeafIO.java
index d53964f..e992d18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataLeafIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/DataLeafIO.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.tree;
 
+import org.apache.ignite.internal.processors.cache.mvcc.TxMvccVersion;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 
@@ -45,4 +46,19 @@ public final class DataLeafIO extends AbstractDataLeafIO {
     @Override protected boolean storeCacheId() {
         return false;
     }
+
+    /** {@inheritDoc} */
+    @Override boolean storeMvccVersion() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateTopologyVersion(long pageAddr, int idx) {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateCounter(long pageAddr, int idx) {
+        return TxMvccVersion.COUNTER_NA;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataInnerIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataInnerIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataInnerIO.java
new file mode 100644
index 0000000..5f4f44c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataInnerIO.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.tree;
+
+import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+
+/**
+ *
+ */
+public final class MvccDataInnerIO extends AbstractDataInnerIO {
+    /** */
+    public static final IOVersions<MvccDataInnerIO> VERSIONS = new IOVersions<>(
+        new MvccDataInnerIO(1)
+    );
+
+    /**
+     * @param ver Page format version.
+     */
+    private MvccDataInnerIO(int ver) {
+        super(T_DATA_REF_MVCC_INNER, ver, true, 28);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getCacheId(long pageAddr, int idx) {
+        return CU.UNDEFINED_CACHE_ID;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean storeCacheId() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean storeMvccVersion() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateTopologyVersion(long pageAddr, int idx) {
+        return PageUtils.getLong(pageAddr, offset(idx) + 12);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateCounter(long pageAddr, int idx) {
+        return PageUtils.getLong(pageAddr, offset(idx) + 20);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataLeafIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataLeafIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataLeafIO.java
new file mode 100644
index 0000000..e7cfca7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/MvccDataLeafIO.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.tree;
+
+import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+
+/**
+ *
+ */
+public final class MvccDataLeafIO extends AbstractDataLeafIO {
+    /** */
+    public static final IOVersions<MvccDataLeafIO> VERSIONS = new IOVersions<>(
+        new MvccDataLeafIO(1)
+    );
+
+    /**
+     * @param ver Page format version.
+     */
+    private MvccDataLeafIO(int ver) {
+        super(T_DATA_REF_MVCC_LEAF, ver, 28);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getCacheId(long pageAddr, int idx) {
+        return CU.UNDEFINED_CACHE_ID;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean storeCacheId() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override boolean storeMvccVersion() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateTopologyVersion(long pageAddr, int idx) {
+        return PageUtils.getLong(pageAddr, offset(idx) + 12);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getMvccUpdateCounter(long pageAddr, int idx) {
+        return PageUtils.getLong(pageAddr, offset(idx) + 20);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/RowLinkIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/RowLinkIO.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/RowLinkIO.java
index 55f880c..8b341cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/RowLinkIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/RowLinkIO.java
@@ -41,4 +41,8 @@ public interface RowLinkIO {
      * @return Cache ID or {@code 0} if cache ID is not defined.
      */
     public int getCacheId(long pageAddr, int idx);
+
+    public long getMvccUpdateTopologyVersion(long pageAddr, int idx);
+
+    public long getMvccUpdateCounter(long pageAddr, int idx);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/SearchRow.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/SearchRow.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/SearchRow.java
index 6257013..dc48928 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/SearchRow.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/SearchRow.java
@@ -73,4 +73,14 @@ public class SearchRow implements CacheSearchRow {
     @Override public int cacheId() {
         return cacheId;
     }
+
+    /** {@inheritDoc} */
+    @Override public long mvccUpdateCounter() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long mvccUpdateTopologyVersion() {
+        return 0;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4bfcde7/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
index c190b1d..384f7b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
@@ -425,6 +425,16 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
         @Override public int cacheId() {
             return 0;
         }
+
+        /** {@inheritDoc} */
+        @Override public long mvccUpdateCounter() {
+            return 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public long mvccUpdateTopologyVersion() {
+            return 0;
+        }
     }
 
     /**


Mime
View raw message