diff --git a/core/src/main/java/com/yahoo/oak/EntryHashSet.java b/core/src/main/java/com/yahoo/oak/EntryHashSet.java index dc9b2fab..c3f76c91 100644 --- a/core/src/main/java/com/yahoo/oak/EntryHashSet.java +++ b/core/src/main/java/com/yahoo/oak/EntryHashSet.java @@ -207,8 +207,8 @@ private boolean isKeyAndEntryKeyEqual(KeyBuffer tempKeyBuff, K key, int idx, int ** --> ctx.key, ctx.value, ctx.keyHash keep the data of the entry's key, value, and key hash */ private EntryState getEntryState(ThreadContext ctx, int idx, K key, int keyHash) { - boolean keyReadResult = false; - boolean valueReadResult = false; + boolean keyReadResult; + boolean valueReadResult; // optimization, as invalid key reference should be the most frequent case if (getKeyReference(idx) == config.keysMemoryManager.getInvalidReference()) { @@ -675,14 +675,12 @@ boolean isEntryDeleted(ValueBuffer tempValue, int ei) { return tempValue.getSlice().isDeleted() != ValueUtils.ValueResult.FALSE; } - /** - * identify the next non zero entry - * @param currentIndex index of the current entry - * @return - */ @Override int getNextNonZeroIndex(int currentIndex) { - int nxtIdx = mapOfCleanEntries.nextSetBit(currentIndex + 1); + int nxtIdx; + synchronized (mapOfCleanEntries) { + nxtIdx = mapOfCleanEntries.nextSetBit(currentIndex + 1); + } if (nxtIdx == -1) { nxtIdx = INVALID_ENTRY_INDEX; } diff --git a/core/src/main/java/com/yahoo/oak/HashChunk.java b/core/src/main/java/com/yahoo/oak/HashChunk.java index 32fe5fc0..aa3e0ad6 100644 --- a/core/src/main/java/com/yahoo/oak/HashChunk.java +++ b/core/src/main/java/com/yahoo/oak/HashChunk.java @@ -333,7 +333,7 @@ class HashChunkIter implements BasicChunkIter { /** - * find the index of the next occupied entry in the entryies array + * find the index of the first occupied entry in the entries array * @param ctx * @return index of the next occupied entry, or INVALID_ENTRY_INDEX if no such index exists */