-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Internal Code
-
Service Arch
-
Service Arch 2024-04-15, Service Arch 2024-04-29
The primary objective is to evaluate the potential performance benefits of using hazard pointers for objects that support stale reads (e.g. replica-set configuration). The findings in this ticket will help us decide on the scheduling plan for SERVER-87020.
We may mimic hazard pointers by creating a mutex protected shared pointer, where the mutex is optimized for readers (see SERVER-86656 for an example).
template <class T> class EmulatedHazardPtr { public: EmulatedHazardPtr(const EmulatedHazardPtr& other) noexcept { std::shared_lock lk(other._mutex); _ptr = other._ptr; } T* get() const noexcept { std::shared_lock lk(_mutex); return _ptr.get(); } void reset() noexcept { std::lock_guard lk(_mutex); _ptr.reset(); } ... private: RWMutex _mutex; std::shared_ptr<T> _ptr; };
- split to
-
SERVER-89631 Make reading `ReplSetConfig` mostly lock-free
- Closed