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

Fastpath no-ops to multikey updates in IndexBuildInterceptor::sideWrite to avoid mutex acquisition

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.1, 4.3.1
    • Component/s: Storage
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.2
    • Sprint:
      Execution Team 2019-07-29, Execution Team 2019-09-09, Execution Team 2019-09-23

      Description

      The hybrid index build's IndexBuildInterceptor accumulates multikey changes in memory which is used to update the persisted index metadata once at the end of the index build.

      Every document inserted into the "side table" will grab a mutex to update this in-memory multikey paths variable. In the common case where a document is not multikey, this shared state does not need to be modified (multikey is similar to a set that can only be added to).

      The serialization was done out of convenience. There's only one exposed helper method for working with MultikeyPaths "objects". Specifically, the following two methods would allow only grabbing the mutex when a document is multikey w.r.t. an index:

      1. Instantiating the default/"empty" multikey object for a given index spec.
      2. A predicate that says whether a MultikeyPaths is equal to the default/"empty".

      Given (1), the _multikeyPaths can be initialized to the correct "shape" at IndexBuildInterceptor construction time. This clause can be removed.
      Given (2) merging would only need to happen if the document could potentially change multikey state.

      UPDATE: This optimization was only made for BTree indexes because all other index types either do not track path-level multikey information or have "special" handling of multikey paths.

        Attachments

          Activity

            People

            Assignee:
            maria.vankeulen Maria van Keulen
            Reporter:
            daniel.gottlieb Daniel Gottlieb
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: