fixed https://github.com/OpenHFT/Chronicle-Map/issues/166 void relocation(Data<V> newValue, long newEntrySize) to void relocation(newValue, newSizeOfEverythingBeforeValue);`

This commit is contained in:
Rob Austin
2018-11-16 17:05:09 +00:00
parent 075083455e
commit 79c7701a52
2 changed files with 5 additions and 6 deletions
@@ -145,7 +145,7 @@ public abstract class MapEntryStages<K, V> extends HashEntryStages<K>
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<K, V> extends HashEntryStages<K>
newValueOffset + newValue.size() - entryStartOffset;
}
protected void relocation(Data<V> newValue, long newSizeOfEverythingBeforeValue) {
long entrySize = innerEntrySize(newSizeOfEverythingBeforeValue, newValue.size());
protected void relocation(Data<V> 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
@@ -167,10 +167,10 @@ public abstract class ReplicatedMapEntryStages<K, V> extends MapEntryStages<K, V
}
@Override
protected void relocation(Data<V> newValue, long newSizeOfEverythingBeforeValue) {
protected void relocation(Data<V> newValue, long newEntrySize) {
long oldPos = pos;
long oldTierIndex = s.tierIndex;
super.relocation(newValue, newSizeOfEverythingBeforeValue);
super.relocation(newValue, newEntrySize);
ru.moveChange(oldTierIndex, oldPos, pos);
}