Fixed a bug in doReplaceValue()

This commit is contained in:
leventov
2015-07-22 22:52:41 +03:00
parent 00ad3068ee
commit 2df3c02750
3 changed files with 9 additions and 3 deletions
@@ -41,7 +41,10 @@ public class AllocatedChunks {
public void initEntryAndKeyCopying(long entrySize, long bytesToCopy) {
initAllocatedChunks(hh.h().inChunks(entrySize));
entry.copyExistingEntry(s.alloc(allocatedChunks), bytesToCopy);
// call incrementSegmentEntriesIfNeeded() before entry.copyExistingEntry(), because
// the latter clears out searchState, and it performs the search again, but in inconsistent
// state
incrementSegmentEntriesIfNeeded();
entry.copyExistingEntry(s.alloc(allocatedChunks), bytesToCopy);
}
}
@@ -39,7 +39,9 @@ public class SearchAllocatedChunks extends AllocatedChunks {
public void initEntryAndKey(long entrySize) {
initAllocatedChunks(hh.h().inChunks(entrySize));
entry.writeNewEntry(s.alloc(allocatedChunks), q.inputKey);
// call incrementSegmentEntriesIfNeeded() before entry.writeNewEntry(), because the latter
// clears out searchState, and it performs the search again, but in inconsistent state
incrementSegmentEntriesIfNeeded();
entry.writeNewEntry(s.alloc(allocatedChunks), q.inputKey);
}
}
@@ -52,7 +52,8 @@ public abstract class MapEntryStages<K, V> extends HashEntryStages<K>
@Stage("ValSize") public long valueSize = -1;
@Stage("ValSize") public long valueOffset;
@Stage("ValSize") private void countValueOffset() {
@Stage("ValSize")
private void countValueOffset() {
mh.m().alignment.alignPositionAddr(entryBytes);
valueOffset = entryBytes.position();
}