Avoid double inserting TableCache in multiple threads
Open
- Dominant language
- C++
- Stars
- 39.4k
- Forks
- 8.2k
- PR merge metrics
- No merged PRs in 30d
Description
If we use the DB::Get interface to read the same data in the SST in multithreading.in table_cache.cc, we use the Lookup interface to check whether the handle exists, the situation may occur: if we have two threads A,B. Thread A is scheduled before thread B. When thread A calls Lookup but does not insert handle into the cache, thread B calls Lookup, which results in * handle == nullptr. Should we add a mutex to the Find interface to prevent a double cache, or better yet, fragment the mutex(use file_number)
Contributor guide
Assessment
This issue has not been assessed yet.