GG-12407: Backport [GG-12364] to 8.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/68c0281d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/68c0281d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/68c0281d Branch: refs/heads/ignite-2.1 Commit: 68c0281dc0f1784f5de2c8ca68c7c2a89f93c397 Parents: 3240900 Author: Ivan Rakov <[email protected]> Authored: Fri Jun 30 18:35:50 2017 +0300 Committer: Ivan Rakov <[email protected]> Committed: Fri Jun 30 18:35:50 2017 +0300 ---------------------------------------------------------------------- .../persistence/GridCacheOffheapManager.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/68c0281d/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 84b1efe..a890fa1 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 @@ -186,22 +186,22 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple IgniteWriteAheadLogManager wal = this.ctx.wal(); if (size > 0 || updCntr > 0) { - int state = -1; + GridDhtPartitionState state = null; if (!grp.isLocal()) { if (beforeDestroy) - state = GridDhtPartitionState.EVICTED.ordinal(); + state = GridDhtPartitionState.EVICTED; else { // localPartition will not acquire writeLock here because create=false. GridDhtLocalPartition part = grp.topology().localPartition(store.partId(), AffinityTopologyVersion.NONE, false); if (part != null && part.state() != GridDhtPartitionState.EVICTED) - state = part.state().ordinal(); + state = part.state(); } // Do not save meta for evicted partitions on next checkpoints. - if (state == -1) + if (state == null) return false; } @@ -229,8 +229,8 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple changed |= io.setGlobalRemoveId(pageAddr, rmvId); changed |= io.setSize(pageAddr, size); - if (state != -1) - changed |= io.setPartitionState(pageAddr, (byte)state); + if (state != null) + changed |= io.setPartitionState(pageAddr, (byte)state.ordinal()); else assert grp.isLocal() : grp.cacheOrGroupName(); @@ -327,8 +327,9 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple wal.log(new MetaPageUpdateNextSnapshotId(grpId, metaPageId, nextSnapshotTag + 1)); - addPartition(ctx.partitionStatMap(), metaPageAddr, io, grpId, PageIdAllocator.INDEX_PARTITION, - this.ctx.kernalContext().cache().context().pageStore().pages(grpId, PageIdAllocator.INDEX_PARTITION)); + if (state == GridDhtPartitionState.OWNING) + addPartition(ctx.partitionStatMap(), metaPageAddr, io, grpId, PageIdAllocator.INDEX_PARTITION, + this.ctx.kernalContext().cache().context().pageStore().pages(grpId, PageIdAllocator.INDEX_PARTITION)); } finally { pageMem.writeUnlock(grpId, metaPageId, metaPage, null, true); @@ -361,7 +362,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple rmvId, size, cntrsPageId, - (byte)state, + (byte)state.ordinal(), pageCnt )); }
