Skip to content

Commit

Permalink
fixed #166 void relocation(Data<V> newValue, long newEntrySize)` to…
Browse files Browse the repository at this point in the history
… `void relocation(newValue, newSizeOfEverythingBeforeValue);`
  • Loading branch information
Rob Austin committed Nov 16, 2018
1 parent 0750834 commit 79c7701
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void innerDefaultReplaceValue(Data<V> newValue) {
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);
Expand Down Expand Up @@ -186,15 +186,14 @@ public long newEntrySize(Data<V> newValue, long entryStartOffset, long newValueO
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public void updatedReplicationStateOnAbsentEntry() {
}

@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);
}

Expand Down

0 comments on commit 79c7701

Please sign in to comment.