growt icon indicating copy to clipboard operation
growt copied to clipboard

find not working for 0 value and above 0xfffffffffffffff (15 bytes)

Open eligbr opened this issue 4 years ago • 2 comments

Hi, I am using

template<typename KeyType, typename ValueStorage>
using GrowtConcurrentHashtable = typename growt::table_config<KeyType, ValueStorage,
                                                              utils_tm::hash_tm::crc_hash, growt::AlignedAllocator<>,
                                                              hmod::growable>::table_type;

With KeyType=uint64_t ValueStorage=int8_t

When I insert value 0 or value above 0xfffffffffffffff and right after I call find with the value I get that the value is not present. I could not find the root cause for this, any idea what is wrong?

Thanks

eligbr avatar Jun 08 '21 14:06 eligbr

Hi, yes indeed, 0 is always considered to be the empty key. The same should be true for 2^63 -1 (which is the deletion tombstone). However, large numbers should not be a problem as long as the most significant bit is not set, in the variant you are using that bit is used to mark migrated elements.

Can you try adding hmod::sync, this removes the need for a marking bit (and it should make 2^64-1 the new deletion tombstone).

TooBiased avatar Jun 08 '21 19:06 TooBiased

Thanks Tobias! So I understand that I should do some transformation on the values (adding +1 for example) and limit the range in order to work with 0 value.

eligbr avatar Jun 09 '21 08:06 eligbr