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

Variables class does not behave as an associative map

    • Fully Compatible
    • ALL
    • 20

      See the related BF for the context. The problem is in Variables class. It's interface seems like an associative map from Id (64 bit int) to Value (ValueAndState).
      However, internally it uses std::vector instead of a real map. So when we call setValue(100000, ...) it actually allocates a vector of 100000 elements and then _valueList[100000] = ...
      Even though there is only 1 variable the underlying vector is 100000 elements big!!! The vector then gets constructed/destructed many times in the $graphlookup hence it takes forever to execute.
      The tangential question is why the Id goes up so much in the graphlookup query. The partial answer is that we do not reset the IdGenerator for every subpipeline we construct. It was deemed more risky to reset if back to 0 than switching to a proper map in Variables class.

            Assignee:
            anton.korshunov@mongodb.com Anton Korshunov
            Reporter:
            martin.neupauer@mongodb.com Martin Neupauer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: