Make searchStatePresent() call in HashLookupSearch.putNewVolatile() independent on assertions enabled. Similar to HashLookupPos.initHashLookupPos() and segmentTier() initialization. Possible fix for #60

This commit is contained in:
leventov
2015-12-03 09:58:07 +03:00
parent b7f815976c
commit 8ea5f2dfac
2 changed files with 12 additions and 6 deletions
@@ -32,9 +32,12 @@ public abstract class HashLookupPos {
public abstract boolean hashLookupPosInit();
public void initHashLookupPos() {
// validation + make hashLookupPos a dependant of tier. This is needed, because after
// tier change should re-perform hashLookupSearch, starting from the searchStartPos
assert s.tier >= 0;
// Validation + make hashLookupPos a dependant of tier. This is needed, because after
// tier change should re-perform hashLookupSearch, starting from the searchStartPos.
// Not an assert statement, because segmentTier stage should be initialized regardless
// assertions enabled or not.
if (s.tier < 0)
throw new AssertionError();
s.innerReadLock.lock();
this.hashLookupPos = hls.searchStartPos;
}
@@ -79,9 +79,12 @@ public abstract class HashLookupSearch {
}
public void putNewVolatile(long value) {
// correctness check + make putNewVolatile() dependant on keySearch, this, in turn,
// is needed for hlp.hashLookupPos re-initialization after nextTier()
assert !ks.searchStatePresent();
// Correctness check + make putNewVolatile() dependant on keySearch, this, in turn,
// is needed for hlp.hashLookupPos re-initialization after nextTier().
// Not an assert statement, because ks.searchStatePresent() should run regardless assertions
// enabled or not.
if (ks.searchStatePresent())
throw new AssertionError();
hl().checkValueForPut(value);
long currentEntry = hl().readEntry(addr(), hlp.hashLookupPos);