Open vikramsubramanian opened 7 months ago
but here are some ideas that might help you get started -
Summary: Locking contention issue with shared in-memory file for string keys in the hash index.
Based on the provided information and code snippets, the following solution can be implemented to address the contention issue with long strings in the shared in-memory file:
InMemFile
class.InMemFile::appendString
method to acquire a lock on the specific page it intends to modify before performing any write operations. Ensure that the lock is released after the operation is completed.InMemHashIndexUtils::insertFuncForString
method to work with the new per-page locking mechanism. Ensure that the lock is acquired before calling InMemFile::appendString
and released afterward.By implementing these changes, each thread will be able to grab and lock only the pages it needs, reducing contention and potentially improving the performance of the system when dealing with long strings.
src/include/storage/index/hash_index_utils.h
This file contains the logic for inserting and checking equality of string keys in the hash index, which is related to the issue of locking contention for long strings.
src/include/storage/storage_structure/in_mem_file.h
This file defines the InMemFile class, which is used for storing string keys in memory and may be involved in the locking contention issue.
src/storage/storage_structure/in_mem_file.cpp
This file contains the implementation of the InMemFile class, including the appendString method, which is relevant to how strings are stored and could be part of the contention issue.
After hashtag2615, we lock a shared in-memory file for string keys in the hash index. Though this works, it is likely (?) a point of contention when strings are long. As mentioned in [this comment]( one solution is to let each thread grab a page at a time. )