Merge branches 'ignite-3477' and 'ignite-4652' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-4652
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d58d0f10 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d58d0f10 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d58d0f10 Branch: refs/heads/ignite-4652 Commit: d58d0f10c537d0c00131cdaa1acfee9a10e30294 Parents: 164995f 5bde9b1 5f83c94 Author: Sergi Vladykin <[email protected]> Authored: Thu Feb 9 16:19:58 2017 +0300 Committer: Sergi Vladykin <[email protected]> Committed: Thu Feb 9 16:19:58 2017 +0300 ---------------------------------------------------------------------- .../ignite/internal/pagemem/PageMemory.java | 4 - .../pagemem/impl/PageMemoryNoStoreImpl.java | 22 +- .../internal/pagemem/wal/record/DataRecord.java | 10 +- .../processors/cache/GridCacheMapEntry.java | 1647 +++++++++++------- .../cache/GridCacheUpdateAtomicResult.java | 96 +- .../cache/IgniteCacheOffheapManager.java | 42 + .../cache/IgniteCacheOffheapManagerImpl.java | 266 ++- .../cache/database/CacheDataRowAdapter.java | 13 + .../cache/database/MetadataStorage.java | 42 - .../cache/database/freelist/FreeListImpl.java | 5 +- .../cache/database/tree/io/BPlusIO.java | 12 - .../distributed/dht/GridDhtCacheEntry.java | 5 + .../apache/ignite/internal/util/GridUnsafe.java | 45 +- .../GridCacheRebalancingSyncSelfTest.java | 12 +- .../processors/database/BPlusTreeSelfTest.java | 11 - .../unsafe/GridUnsafeMemorySelfTest.java | 35 + .../junits/common/GridCommonAbstractTest.java | 7 +- .../ignite/testsuites/IgniteCacheTestSuite.java | 10 - .../testsuites/IgniteCacheTestSuite5.java | 19 +- .../query/h2/database/io/H2InnerIO.java | 10 - .../query/h2/database/io/H2LeafIO.java | 10 - 21 files changed, 1438 insertions(+), 885 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d58d0f10/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index e1ea6d1,531665c,eed9f09..77923c6 --- 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 @@@@ -954,40 -953,40 -1042,65 +1041,65 @@@@ public class IgniteCacheOffheapManagerI } else old = dataTree.put(dataRow); -- -- if (old == null) -- storageSize.incrementAndGet(); } -- if (indexingEnabled) { -- GridCacheQueryManager qryMgr = cctx.queries(); ++ finishUpdate(dataRow, old); ++ } ++ finally { ++ busyLock.leaveBusy(); ++ } ++ } + - assert qryMgr.enabled(); ++ /** ++ * @param newRow New row. ++ * @param oldRow Old row if available. ++ * @throws IgniteCheckedException If failed. ++ */ ++ private void finishUpdate(CacheDataRow newRow, @Nullable CacheDataRow oldRow) throws IgniteCheckedException { ++ if (oldRow == null) ++ storageSize.incrementAndGet(); - if (old != null) - qryMgr.store(key, p, old.value(), old.version(), val, ver, expireTime, dataRow.link()); - else - qryMgr.store(key, p, null, null, val, ver, expireTime, dataRow.link()); - } - assert qryMgr.enabled(); ++ KeyCacheObject key = newRow.key(); - if (old != null) { - assert old.link() != 0 : old; - if (old != null) - qryMgr.store(key, p, old.value(), old.version(), val, ver, expireTime, dataRow.link()); - else - qryMgr.store(key, p, null, null, val, ver, expireTime, dataRow.link()); - } ++ long expireTime = newRow.expireTime(); - if (pendingEntries != null && old.expireTime() != 0) - pendingEntries.removex(new PendingRow(old.expireTime(), old.link())); - if (old != null) { - assert old.link() != 0 : old; ++ if (indexingEnabled) { ++ GridCacheQueryManager qryMgr = cctx.queries(); - if (rmvOld) - rowStore.removeRow(old.link()); - if (pendingEntries != null && old.expireTime() != 0) - pendingEntries.removex(new PendingRow(old.expireTime(), old.link())); ++ assert qryMgr.enabled(); + - if (rmvOld) - rowStore.removeRow(old.link()); ++ if (oldRow != null) { ++ qryMgr.store(key, ++ partId, ++ oldRow.value(), oldRow.version(), ++ newRow.value(), newRow.version(), ++ expireTime, ++ newRow.link()); ++ } ++ else { ++ qryMgr.store(key, ++ partId, ++ null, null, ++ newRow.value(), newRow.version(), ++ expireTime, ++ newRow.link()); } ++ } -- if (pendingEntries != null && expireTime != 0) -- pendingEntries.putx(new PendingRow(expireTime, dataRow.link())); ++ if (oldRow != null) { ++ assert oldRow.link() != 0 : oldRow; -- updateIgfsMetrics(key, (old != null ? old.value() : null), val); -- } -- finally { -- busyLock.leaveBusy(); ++ if (pendingEntries != null && oldRow.expireTime() != 0) ++ pendingEntries.removex(new PendingRow(oldRow.expireTime(), oldRow.link())); ++ ++ if (newRow.link() != oldRow.link()) ++ rowStore.removeRow(oldRow.link()); } ++ ++ if (pendingEntries != null && expireTime != 0) ++ pendingEntries.putx(new PendingRow(expireTime, newRow.link())); ++ ++ updateIgfsMetrics(key, (oldRow != null ? oldRow.value() : null), newRow.value()); } /** {@inheritDoc} */ @@@@ -996,40 -995,40 -1109,49 +1108,49 @@@@ throw new NodeStoppingException("Operation has been cancelled (node is stopping)."); try { -- CacheDataRow dataRow = dataTree.remove(new SearchRow(key)); - - CacheObject val = null; - GridCacheVersion ver = null; ++ CacheDataRow oldRow = dataTree.remove(new SearchRow(key)); - CacheObject val = null; - GridCacheVersion ver = null; - -- if (dataRow != null) { -- assert dataRow.link() != 0 : dataRow; ++ finishRemove(key, oldRow); ++ } ++ finally { ++ busyLock.leaveBusy(); ++ } ++ } -- if (pendingEntries != null && dataRow.expireTime() != 0) -- pendingEntries.removex(new PendingRow(dataRow.expireTime(), dataRow.link())); ++ /** ++ * @param key Key. ++ * @param oldRow Removed row. ++ * @throws IgniteCheckedException If failed. ++ */ ++ private void finishRemove(KeyCacheObject key, @Nullable CacheDataRow oldRow) throws IgniteCheckedException { ++ CacheObject val = null; ++ GridCacheVersion ver = null; -- storageSize.decrementAndGet(); ++ if (oldRow != null) { ++ assert oldRow.link() != 0 : oldRow; -- val = dataRow.value(); ++ if (pendingEntries != null && oldRow.expireTime() != 0) ++ pendingEntries.removex(new PendingRow(oldRow.expireTime(), oldRow.link())); -- ver = dataRow.version(); -- } ++ storageSize.decrementAndGet(); -- if (indexingEnabled) { -- GridCacheQueryManager qryMgr = cctx.queries(); ++ val = oldRow.value(); -- assert qryMgr.enabled(); ++ ver = oldRow.version(); ++ } -- qryMgr.remove(key, partId, val, ver); -- } ++ if (indexingEnabled) { ++ GridCacheQueryManager qryMgr = cctx.queries(); -- if (dataRow != null) -- rowStore.removeRow(dataRow.link()); ++ assert qryMgr.enabled(); -- updateIgfsMetrics(key, (dataRow != null ? dataRow.value() : null), null); -- } -- finally { -- busyLock.leaveBusy(); ++ qryMgr.remove(key, partId, val, ver); } ++ ++ if (oldRow != null) ++ rowStore.removeRow(oldRow.link()); ++ ++ updateIgfsMetrics(key, (oldRow != null ? oldRow.value() : null), null); } /** {@inheritDoc} */
