Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-82648

Improve the locking in LogicalTimeValidator::get/set

    • Cluster Scalability
    • Cluster Scalability 2023-11-13, Cluster Scalability 2023-11-27, Cluster Scalability 2023-12-11, Cluster Scalability 2023-12-25, Cluster Scalability 2024-1-8, Cluster Scalability 2024-1-22, Cluster Scalability 2024-2-5, Cluster Scalability 2024-2-19, Cluster Scalability 2024-3-4, Cluster Scalability 2024-3-18, Cluster Scalability 2024-4-1, Cluster Scalability 2024-4-15, Cluster Scalability 2024-4-29, Cluster Scalability 2024-5-13, Cluster Scalability 2024-5-27, Cluster Scalability 2024-6-10, Cluster Scalability 06/24/24, Cluster Scalability 2024-07-08, Cluster Scalability 2024-07-22

      LogicalTimeValidator::get/set uses a global mutex to protect a shared pointer. C++20 adds support for atomic shared_ptr's but our toolchain v4 compilers do not yet support it. LogicalTimeValidator is set once or twice in its life during startup (see SERVER-78036 ) and never again.

      Ideally, a cheap memory reclamation technology like hazard pointers could be used to protect writes to this shared pointer. But since that does not exist in the code base, an alternative is to use a partitioned reader/writer lock so that all the readers do not have to touch the same cache line for taking the reader/writer lock.

      POC: https://github.com/10gen/mongo/commit/b28b01966c174f13527ecc19c0e507d0ba38ab36

            Assignee:
            backlog-server-cluster-scalability [DO NOT USE] Backlog - Cluster Scalability
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: