From 79c7701a52058361150f7d2e7139cbd0d4211a9f Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Fri, 16 Nov 2018 17:05:09 +0000 Subject: [PATCH] fixed https://github.com/OpenHFT/Chronicle-Map/issues/166 `void relocation(Data newValue, long newEntrySize)`` to `void relocation(newValue, newSizeOfEverythingBeforeValue);` --- .../chronicle/map/impl/stage/entry/MapEntryStages.java | 7 +++---- .../map/impl/stage/entry/ReplicatedMapEntryStages.java | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/entry/MapEntryStages.java b/src/main/java/net/openhft/chronicle/map/impl/stage/entry/MapEntryStages.java index ba9a498bd..7a50bce30 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/entry/MapEntryStages.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/entry/MapEntryStages.java @@ -145,7 +145,7 @@ public abstract class MapEntryStages extends HashEntryStages if (s.realloc(pos, entrySizeInChunks, newSizeInChunks)) { break newValueDoesNotFit; } - relocation(newValue, newSizeOfEverythingBeforeValue); + relocation(newValue, newEntrySize); return; } else if (newSizeInChunks < entrySizeInChunks) { s.freeExtra(pos + 1, entrySizeInChunks, newSizeInChunks); @@ -186,15 +186,14 @@ public abstract class MapEntryStages extends HashEntryStages newValueOffset + newValue.size() - entryStartOffset; } - protected void relocation(Data newValue, long newSizeOfEverythingBeforeValue) { - long entrySize = innerEntrySize(newSizeOfEverythingBeforeValue, newValue.size()); + protected void relocation(Data newValue, long newEntrySize) { // need to copy, because in initEntryAndKeyCopying(), in alloc(), nextTier() called -> // hashLookupPos cleared, as a dependant long oldHashLookupPos = hlp.hashLookupPos; long oldHashLookupAddr = s.tierBaseAddr; boolean tierHasChanged = allocatedChunks.initEntryAndKeyCopying( - entrySize, valueSizeOffset - keySizeOffset, pos, entrySizeInChunks); + newEntrySize, valueSizeOffset - keySizeOffset, pos, entrySizeInChunks); if (tierHasChanged) { // implicitly inits key search, locating hashLookupPos on the empty slot diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/entry/ReplicatedMapEntryStages.java b/src/main/java/net/openhft/chronicle/map/impl/stage/entry/ReplicatedMapEntryStages.java index 6716a013d..ab64c3a8d 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/entry/ReplicatedMapEntryStages.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/entry/ReplicatedMapEntryStages.java @@ -167,10 +167,10 @@ public abstract class ReplicatedMapEntryStages extends MapEntryStages newValue, long newSizeOfEverythingBeforeValue) { + protected void relocation(Data newValue, long newEntrySize) { long oldPos = pos; long oldTierIndex = s.tierIndex; - super.relocation(newValue, newSizeOfEverythingBeforeValue); + super.relocation(newValue, newEntrySize); ru.moveChange(oldTierIndex, oldPos, pos); }