Closed charles-typ closed 5 years ago
Previous Question:
typedef std::unordered_map<key_type, value_type, hash_type, equal_type> hash_table_type;
where the key_type and value_type are both binary string
Each time in functions "update" and "put" and "get", I need to first convert the key(std::string) to a binary string, and sometimes There would be an error that there are no more memory to allocate for the (temporary)binary string and cause the service to throw. I am checking the memory space every time before I constructs the binary string. Is there a cleaner way to fix this?
( Also commented in line)Fix:
Add exception handler to every make_binary, and return "!redo".
But for scale_remove and remove, since we want the partition to be able to reduce its size of data instead of stuck in this "!redo", I added a new memory allocator simply for allocating the temporary values for removing data.
The memory allocator should not use much space since it's storing temporary data only and the space could be set in libjiffy/src/jiffy/storage/hash_table/hash_table_defs.h : HASH_TABLE_MAX_KEY_SIZE
Currently it's set to 65536, could be set much more bigger since it would release the memory immediately after allocating it.
Looks good to me. Keeping maximum key size at 64kB is reasonable, keys larger than that are uncommon. Feel free to merge.
Is this still WIP?
No it's finished. title changed
Changes in this PR:
TODOs: