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

XMLWordPrintableJSON

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

      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
            Reporter:
            Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: