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

OakHashMap Api #161

Merged
merged 19 commits into from
Jun 21, 2021
Merged

OakHashMap Api #161

merged 19 commits into from
Jun 21, 2021

Conversation

OrHayat
Copy link
Contributor

@OrHayat OrHayat commented May 19, 2021

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.
#141

Copy link
Contributor

@sanastas sanastas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job done! Thanks! Some comments inside, feel free to react when addressing the comment.

And waiting for the parameterized tests addition.

core/src/main/java/com/yahoo/oak/InternalOakHashMap.java Outdated Show resolved Hide resolved
core/src/main/java/com/yahoo/oak/OakHashMap.java Outdated Show resolved Hide resolved
core/src/main/java/com/yahoo/oak/OakHashMap.java Outdated Show resolved Hide resolved



private final K fromKey;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you bother those those "to be removed" fields you can add a //TODO: comment saying it will be removed as soon as internalOakHashMap introduced to this code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it can be initialized here instead of constructor

this.valuesMemoryManager, kMM, chunkMaxItems, new ValueUtils());


this.fromKey = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking deeper about it, assigning all those parameters to undefined value, making it impossible to do parametrized testing for iterators... @liran-funaro what do you think to rewrite iterator's invocation code for OakHash inside ConcurrentZCMap interface?

core/src/main/java/com/yahoo/oak/OakMapBuilder.java Outdated Show resolved Hide resolved
@sanastas
Copy link
Contributor

@OrHayat , excellent!

Is it the end of correction of the previous code review comments?

@OrHayat
Copy link
Contributor Author

OrHayat commented Jun 12, 2021 via email

@sanastas
Copy link
Contributor

Thank you Or!

We will review the code regardless to the check failure.
It should be enough that there is one test that passes through the code. @liran-funaro can you please take a look?

Copy link
Contributor

@sanastas sanastas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or (@OrHayat) thank you very much! This is an initial review, will continue tomorrow.

core/src/main/java/com/yahoo/oak/ConcurrentZCMap.java Outdated Show resolved Hide resolved
core/src/main/java/com/yahoo/oak/OakMapBuilder.java Outdated Show resolved Hide resolved
return valuesMemoryManager;
}

public static class OakZeroCopyMap<K, V> implements ZeroCopyMap<K, V> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the same name as in OakMap class? Is it legitimate at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liran-funaro can a template be made for OakMap vs OakHashMap?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why not. I think we should try to do it.

Copy link
Contributor

@sanastas sanastas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. I am done with the review. My biggest comment is about MapApiTest below. @OrHayat would you like a meeting for more explanations?

Copy link
Contributor

@liran-funaro liran-funaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Note that there are some places we can have more code-reuse than we do (e.g., the KeySet/EntrySet classes).

Kudos for the effort in parametrizing the tests. It is very important for the development effort.
I think parametrizing the API test should be sufficient to cover the rest of the uncovered lines.
Please let us know if you have the capacity for these additional changes.
Otherwise, we'll need to start working on it ourselves as the time is pressing on this.

core/src/main/java/com/yahoo/oak/OakHashMap.java Outdated Show resolved Hide resolved
return valuesMemoryManager;
}

public static class OakZeroCopyMap<K, V> implements ZeroCopyMap<K, V> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why not. I think we should try to do it.


/* ---------------- View Classes -------------- */

static class KeySet<K> extends AbstractSet<K> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse the code of KeySet, EntrySet, and the others from OakMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not easily because they are inner classes of the respective classes because you wanted the iterators of the OakHashMap and OakMap functions to be private and be avilable only from the code of KeySet and such.

@sanastas sanastas merged commit 91da8fb into yahoo:master Jun 21, 2021
@sanastas
Copy link
Contributor

Dear Or (@OrHayat ) thank you very much for your significant contribution! It was a pleasure to work with you! Hope to continue collaboration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants