Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added synch to mapOfCleanEntries #208

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions core/src/main/java/com/yahoo/oak/EntryHashSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/com/yahoo/oak/HashChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down