[44/50] [abbrv] ignite git commit: ignite-3477 PageMemory optimizations - use page address instead of ByteBuffer to work with page memory - got rid of pages pin/unpin - do not copy byte array for cach
ignite-3477 PageMemory optimizations - use page address instead of ByteBuffer to work with page memory - got rid of pages pin/unpin - do not copy byte array for cache key comparison - reduced size of data tree search row Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7db65ddd Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7db65ddd Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7db65ddd Branch: refs/heads/ignite-gg-11810-2 Commit: 7db65ddd16beae5f5bf95f67c638d5ae1c58653c Parents: cb60e38 Author: sboikov Authored: Tue Jan 17 14:45:51 2017 +0300 Committer: sboikov Committed: Tue Jan 17 14:45:53 2017 +0300 -- .../internal/binary/BinaryEnumObjectImpl.java | 7 + .../internal/binary/BinaryObjectImpl.java | 5 + .../binary/BinaryObjectOffheapImpl.java | 5 + .../apache/ignite/internal/pagemem/Page.java| 11 +- .../ignite/internal/pagemem/PageMemory.java | 9 +- .../ignite/internal/pagemem/PageUtils.java | 185 ++ .../pagemem/impl/PageMemoryNoStoreImpl.java | 134 ++-- .../internal/pagemem/impl/PageNoStoreImpl.java | 91 +-- .../delta/DataPageInsertFragmentRecord.java | 8 +- .../wal/record/delta/DataPageInsertRecord.java | 8 +- .../wal/record/delta/DataPageRemoveRecord.java | 8 +- .../delta/DataPageSetFreeListPageRecord.java| 8 +- .../wal/record/delta/FixCountRecord.java| 8 +- .../record/delta/FixLeftmostChildRecord.java| 8 +- .../pagemem/wal/record/delta/FixRemoveId.java | 8 +- .../wal/record/delta/InitNewPageRecord.java | 8 +- .../wal/record/delta/InnerReplaceRecord.java| 4 +- .../pagemem/wal/record/delta/InsertRecord.java | 5 +- .../pagemem/wal/record/delta/MergeRecord.java | 3 +- .../wal/record/delta/MetaPageAddRootRecord.java | 8 +- .../wal/record/delta/MetaPageCutRootRecord.java | 7 +- .../wal/record/delta/MetaPageInitRecord.java| 14 +- .../record/delta/MetaPageInitRootRecord.java| 9 +- .../delta/MetaPageUpdateLastAllocatedIndex.java | 10 +- ...aPageUpdateLastSuccessfulFullSnapshotId.java | 8 +- .../MetaPageUpdateLastSuccessfulSnapshotId.java | 8 +- .../delta/MetaPageUpdateNextSnapshotId.java | 8 +- .../MetaPageUpdatePartitionDataRecord.java | 12 +- .../wal/record/delta/NewRootInitRecord.java | 6 +- .../wal/record/delta/PageDeltaRecord.java | 7 +- .../delta/PageListMetaResetCountRecord.java | 8 +- .../record/delta/PagesListAddPageRecord.java| 8 +- .../delta/PagesListInitNewPageRecord.java | 10 +- .../record/delta/PagesListRemovePageRecord.java | 8 +- .../record/delta/PagesListSetNextRecord.java| 8 +- .../delta/PagesListSetPreviousRecord.java | 8 +- .../pagemem/wal/record/delta/RecycleRecord.java | 6 +- .../pagemem/wal/record/delta/RemoveRecord.java | 12 +- .../pagemem/wal/record/delta/ReplaceRecord.java | 7 +- .../record/delta/SplitExistingPageRecord.java | 8 +- .../record/delta/SplitForwardPageRecord.java| 3 +- .../record/delta/TrackingPageDeltaRecord.java | 10 +- .../internal/processors/cache/CacheObject.java | 7 + .../processors/cache/CacheObjectAdapter.java| 40 +- .../cache/CacheObjectByteArrayImpl.java | 5 + .../cache/IgniteCacheOffheapManagerImpl.java| 372 +++ .../processors/cache/database/CacheDataRow.java | 13 +- .../cache/database/CacheDataRowAdapter.java | 72 ++- .../cache/database/CacheSearchRow.java | 40 ++ .../cache/database/DataStructure.java | 36 +- .../IgniteCacheDatabaseSharedManager.java | 2 +- .../cache/database/MetadataStorage.java | 149 +++-- .../cache/database/freelist/FreeListImpl.java | 61 +- .../cache/database/freelist/PagesList.java | 212 +++ .../database/freelist/io/PagesListMetaIO.java | 71 +-- .../database/freelist/io/PagesListNodeIO.java | 117 ++-- .../cache/database/tree/BPlusTree.java | 616 ++- .../cache/database/tree/io/BPlusIO.java | 201 +++--- .../cache/database/tree/io/BPlusInnerIO.java| 71 ++- .../cache/database/tree/io/BPlusLeafIO.java | 11 +- .../cache/database/tree/io/BPlusMetaIO.java | 79 +-- .../cache/database/tree/io/CacheVersionIO.java | 46 ++ .../cache/database/tree/io/DataPageIO.java | 545 .../cache/database/tree/io/DataPagePayload.java | 64 ++ .../cache/database/tree/io/IOVersions.java | 12 +- .../cache/database/tree/io/PageIO.java | 110 +++- .../cache/database/tree/io/PageMetaIO.java | 118 ++-- .../database/tree/io/PagePartitionMetaIO.java | 67 +- .../database/tree/reuse/ReuseListImpl.java | 2 +- .../cache/database/tree/util/PageHandler.java | 135 ++-- .../database/tree/util/PageLockListener.java| 17 +- .../atomic/GridDhtAtomicSingleUpd
[44/50] [abbrv] ignite git commit: ignite-3477 PageMemory optimizations - use page address instead of ByteBuffer to work with page memory - got rid of pages pin/unpin - do not copy byte array for cach
http://git-wip-us.apache.org/repos/asf/ignite/blob/7db65ddd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/PageIO.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/PageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/PageIO.java index aa2d368..f6ac905 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/PageIO.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/PageIO.java @@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.cache.database.tree.io; import java.nio.ByteBuffer; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.pagemem.Page; +import org.apache.ignite.internal.pagemem.PageMemory; +import org.apache.ignite.internal.pagemem.PageUtils; import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager; import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManagerImpl; import org.apache.ignite.internal.processors.cache.database.MetadataStorage; @@ -36,10 +38,10 @@ import org.apache.ignite.internal.processors.cache.database.tree.util.PageLockLi * 1. IO should not have any `public static` methods. *We have versioned IOs and any static method will mean that it have to always work in backward *compatible way between all the IO versions. The base class {@link PageIO} has - *static methods (like {@code {@link #getPageId(ByteBuffer)}}) intentionally: + *static methods (like {@code {@link #getPageId(long)}}) intentionally: *this base format can not be changed between versions. * - * 2. IO must correctly override {@link #initNewPage(ByteBuffer, long)} method and call super. + * 2. IO must correctly override {@link #initNewPage(long, long, int)} method and call super. *We have logic that relies on this behavior. * * 3. Page IO type ID constant must be declared in this class to have a list of all the @@ -58,7 +60,7 @@ import org.apache.ignite.internal.processors.cache.database.tree.util.PageLockLi * * 7. It is almost always preferable to read or write (especially write) page contents using *static methods on {@link PageHandler}. To just initialize new page use - *{@link PageHandler#initPage(Page, PageLockListener, PageIO, IgniteWriteAheadLogManager)} + *{@link PageHandler#initPage(PageMemory, Page, PageLockListener, PageIO, IgniteWriteAheadLogManager)} *method with needed IO instance. */ public abstract class PageIO { @@ -164,6 +166,7 @@ public abstract class PageIO { } /** + * @param buf Buffer. * @return Page type. */ public static int getType(ByteBuffer buf) { @@ -171,13 +174,21 @@ public abstract class PageIO { } /** - * @param buf Buffer. + * @param pageAddr Page addres. + * @return Page type. + */ +public static int getType(long pageAddr) { +return PageUtils.getShort(pageAddr, TYPE_OFF) & 0x; +} + +/** + * @param pageAddr Page address. * @param type Type. */ -public static void setType(ByteBuffer buf, int type) { -buf.putShort(TYPE_OFF, (short)type); +public static void setType(long pageAddr, int type) { +PageUtils.putShort(pageAddr, TYPE_OFF, (short)type); -assert getType(buf) == type; +assert getType(pageAddr) == type; } /** @@ -189,13 +200,21 @@ public abstract class PageIO { } /** - * @param buf Buffer. + * @param pageAddr Page address. + * @return Version. + */ +public static int getVersion(long pageAddr) { +return PageUtils.getShort(pageAddr, VER_OFF) & 0x; +} + +/** + * @param pageAddr Page address. * @param ver Version. */ -public static void setVersion(ByteBuffer buf, int ver) { -buf.putShort(VER_OFF, (short)ver); +private static void setVersion(long pageAddr, int ver) { +PageUtils.putShort(pageAddr, VER_OFF, (short)ver); -assert getVersion(buf) == ver; +assert getVersion(pageAddr) == ver; } /** @@ -207,13 +226,37 @@ public abstract class PageIO { } /** - * @param buf Buffer. + * @param pageAddr Page address. + * @return Page ID. + */ +public static long getPageId(long pageAddr) { +return PageUtils.getLong(pageAddr, PAGE_ID_OFF); +} + +/** + * @param pageAddr Page address. * @param pageId Page ID. */ -public static void setPageId(ByteBuffer buf, long pageId) { -buf.putLong(PAGE_ID_OFF, pageId); +public static void setPageId(long pageAddr, long pageId) { +PageUtils.putLong(pageAddr, PAGE_ID_OFF, pageId); + +assert getPageId(pageAddr) == pageId; +} + +/** + *