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

Generate shardMaps outside MODE_X collection lock

    • Sharding

      SERVER-31428 moved the generation of the CollectionMetadata chunksMap into the MODE_X collection lock section, as a way of serialising concurrent metadata refreshes, and thereby avoiding the redundant computation performance penalty from all metadata refreshing threads generating the map at the same time. However, all that is actually required is to ensure that this map is generated only once, by one thread, ie. it isn't necessary to hold the MODE_X collection lock to create this data structure. Therefore it would be better if this map was created outside the collection lock (by just one thread), to reduce the time that it's held.

      Most likely this will involve a variant of CatalogCache::getCollectionRoutingInfo, which accepts a lambda to be called-back (guaranteed by a single thread) and this lambda is what updates the metadata on the CollectionShardingState.

            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            kevin.pulo@mongodb.com Kevin Pulo
            0 Vote for this issue
            6 Start watching this issue