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

Make getDocumentKey get the shardKeyPattern from collectionPtr instead of asking the CSS every time

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Fully Compatible
    • Sharding EMEA 2022-11-28
    • 132

      SERVER-69435 made obtaining the CollectionShardingState more costly, as it now needs to lock a mutex. This introduced a performance regression on some write paths – particularly the insert path. This is because getDocumentKey is called for every document in the batch, and every time getDocumentKey will obtain the CollectionShardingState.
      It is unnecessary to get the CSS for every document in the batch. Instead, it can be obtained only once for the operation and use it for every document in the batch.

            Assignee:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: