FindCmd checks the bool value of an optional incorrectly

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • Fully Compatible
    • ALL
    • QE 2023-02-06
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The comment here:

                  // Set the namespace if a collection was found, as opposed to nothing or a view.
                  if (ctx) {
                      query_request_helper::refreshNSS(ctx->getNss(), findCommand.get());
                  }
      

      make it seem like refreshNss should only be evaluated if the collection exists in ctx, which is of type boost::optional<AutoGetCollectionForReadCommandMaybeLockFree>. But it's actually only checking whether the optional is populated. But the optional is always populated so refreshNss always runs.

      It should probably be if (*ctx) or the code should be rewritten to not use an optional, but that might be difficult since we manually reset the optional later on.

            Assignee:
            Adi Agrawal (Inactive)
            Reporter:
            Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: