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

Avoid force collection cache refresh in MongosProcessInterface::ensureFieldsUniqueOrResolveDocumentKey

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • ALL

      ensureFieldsUniqueOrResolveDocumentKey() is used as part of the merge operator implementation and has different behavior depending if it is executed on the router or on the shard role. On the router, this function has the responsibility to retrieve the shard key pattern and the version of the target collection.

      The target collection version is later pushed down to the shards that will use it to ensure that the collection is not dropped and recreated during the merge/$out operation.

      The current implementation of ensureFieldsUniqueOrResolveDocumentKey() is forcing a refresh of the catalog cache, this is very inefficient because it causes all the other concurrent thread that are accessing the catalog cache for the same collection to wait for the forced refresh to complete.

      The refresh should not be necessary in this case and in fact even forcing a refresh does not guarantee that the retrieved metadata are the latest present on the config server.

            Assignee:
            Unassigned Unassigned
            Reporter:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: