Open KFilipek opened 4 years ago
@vinser52 could you look at this? I think there is some type mismatch (_node_allocator vs allocator_type).
I will have a look today.
I think the issue is that we return allocator_type
object by reference (not by value, like std::map) while internally we are using node_allocator_type
object.
The easiest solution is to store allocator_type
object in addition to node_allocator_type
object inside concurrent_skip_list. But it means that we will use node_allocator_type
object for allocation inside the skip list but get_allocator()
method will return another object.
From the first point of view I do not see any issues with that. What do you think?
@igchor Do you remember why we decided to return by reference. I remember we had some discussion about that, but I forgot details.
I think we changed it along with key_comp to allow altering the allcoator/comparator by the user. It was used in pmemkv to call runtime_initialize() on comparator.
If we want to return reference, we should definitely return reference to the actual allocator which is used for allocations. So we probably have 2 options:
There is third option: Remove get_allocator() method for now. Until we have no use case where it is required I think we can remove it and think how to implement it in a right way.
Ok, let's do that, and maybe let's also put a comment with link to this issue.
@KFilipek will you do this?
Sure, I've updated the PR #825 with proper changes.
@igchor Related PR (#825 ) was merged to the master branch. Can we close this issue?
I think we should keep it open (but probably not as a bug), since the current solution is mostly a workaround.
Hi, I've got conversion issue in this PR: #825 @vinser52, can you help with this problem?
Environment Information
Please provide a reproduction of the bug:
Just compile code #825
How often bug is revealed:
always
Actual behavior:
Additional information about Priority and Help Requested:
Are you willing to submit a pull request with a proposed change? Yes
Requested priority: High